fix #5
Merge pull request #6 from byronyi/master

fix #5 
File opener and error handling fix for UnboundLocalError