More fixes for FreeBSD (calling close on socket file descriptors in
destructors).