close file handles, fixes CID 1222793
match comparators
Merge pull request #574 from ged-lab/fix/coverity-1222793

close file handles, fixes CID 1222793