Ensure all open file handles and streams are properly closed
Merge pull request #120 from mdlayher/master

Ensure all open file handles and streams are properly closed