Fix file closure