Fix file handle leak
Merge pull request #899 from nla/fd-leak

Yet another pair of file handle leaks