Fixed the issue with saving a duplicated file resultign in the file being considered locked (closes #403).