Fix unclosed file