Fix file leak on exception path.

Found by Coverity.