If I only had a brain...fixed file closing issue