Fix file handle leak.