Bugfix on closing file and clarified documentation