modified write_temp_file to accept suffix argument