Please consider use the ```temp_filename()``` context manager for this. It avoids the need to remove the file.