Fixed subtle logic bug for duplicate instances: need to make sure to raise the error, even if there are no attached files to save.