Metadata: fix deletion of temporary XML file when writing new metadata to saved files

This broke as a byproduct of my previous metadata fixes - oops!