fix leak of open files
Merge pull request #47 from Keyintegrity/master

#46 fix leak of open files