Close the child file descriptors

Ensure the child closes any fd's inherited from the parent and clean up
the fd's in the parent when the child exits.

There are 2 remaining problems:

1. The parent may have raised the fd limit using setrlimit. The child
   will not close these fd's.

2. The code assumes child stdin/stderr are closed before SIGCHLD is
   received, so fd's can still leak.