Fix non-closed file descriptors