Calling .close before file had fully opened resulted in crash 

Calling .close before file had fully opened resulted in crash

[Fixes #9]