Fixes bug with tempfile

tempfile.gettempdir returns the directory currently selected to host temporary
files, you should only use this if you make a subdirectory with content and
intend to clean it up. Otherwise it's easier and cleaner to use
`tempfile.mkdtemp`.