Close a file descriptor on error

Just to be cleaner in the exit path, we close the bekfile's file
descriptor in an error case.
Fix error on the 1st arg sign of FD_SET for glibc < 2.16

The commit ceb9e56b3d1f8c1922e0526c2e841373843460e2 in the glibc tree
fix the issue of a signedness problem in the FD_SET macro. As Ubuntu
12.04 uses glibc v2.13, we fix the signedness using a macro-wrapper. The
above commit fixing the problem appeared just before the 2.16 tag, so we
check for the glibc version < 2.16.