Fix file descriptor leak. By LCG (David.Smith@cern.ch).