Some minor cleaning up [ci skip].
Fixed the issue about being able to create a new file only if there is already one that is opened (closes #388).