Fix tests and close_fds()