Correctly creates and removes temp-files