TS-1475: Close file descriptor after diff. Coverity #1021825
Fixing broken regressions