[BUG] O(1) pollers should check their FD before closing it

epoll, sepoll and kqueue pollers should check that their fd is not
closed before attempting to close it, otherwise we can end up with
multiple closes of fd #0 upon exit, which is harmless but dirty.
diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c
index 7e626d1..e167984 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -188,7 +188,7 @@
 	free(kev);
  fail_kev:
 	close(kqueue_fd);
-	kqueue_fd = 0;
+	kqueue_fd = -1;
  fail_fd:
 	p->pref = 0;
 	return 0;
@@ -203,8 +203,11 @@
 	free(fd_evts[DIR_WR]);
 	free(fd_evts[DIR_RD]);
 	free(kev);
-	close(kqueue_fd);
-	kqueue_fd = 0;
+
+	if (kqueue_fd >= 0) {
+		close(kqueue_fd);
+		kqueue_fd = -1;
+	}
 
 	p->private = NULL;
 	p->pref = 0;
@@ -232,7 +235,8 @@
  */
 REGPRM1 static int _do_fork(struct poller *p)
 {
-	close(kqueue_fd);
+	if (kqueue_fd >= 0)
+		close(kqueue_fd);
 	kqueue_fd = kqueue();
 	if (kqueue_fd < 0)
 		return 0;
@@ -251,6 +255,8 @@
 
 	if (nbpollers >= MAX_POLLERS)
 		return;
+
+	kqueue_fd = -1;
 	p = &pollers[nbpollers++];
 
 	p->name = "kqueue";