Create output files as .tmp first, renaming when finished.