Ensure file handles are closed when exception occurs in lines 206 - 217
Merge pull request #5 from svisser/patch-1

Ensure file handles are closed when exception occurs in lines 206 - 217