Close file if Open fails.

fixes #1
addjust sub-package imports
Merge remote-tracking branch 'real/master'