close temporary script files

close the temporary script files when done using them (some of them were remaining in /tmp)