Fix for corrupt output files in “saveall” mode