Second try to fix unclosed file descriptors