Some minor cleaning up [ci skip].
Fixed the issue with a duplicated file being closed but not saved, and showing up next time round (closes #264).