Fix cleanup of temporary files