Fix unclosed file warning