Now the script properly cleans up all the temp files.