Improved the resetting of a file object in our file manager [ci skip].
Delete temporary files that get created for duplicated/new files (closes #266).