Optionally notify when a child proc closes stdio

Generate an event when the child process closes stdout or stderr,
similar to the control fd. The idea is to try simplifying the C code
by moving some of the logic into the gen_server.