add spec test for EBADF in closing fds