Remove race on file descriptor