syncdaemon: Make sure file descriptors are closed