In brief
tempfile.TemporaryDirectory can act as a context manager that cleans up its temporary directory on exit. It suits intermediate conversion files.
Useful to know
tempfile.TemporaryDirectory can act as a context manager that cleans up its temporary directory on exit. It suits intermediate conversion files. [1]
Do not keep the only required result there. Save or move the final file to its intended destination before leaving the context. A temporary workspace and a recovery backup have different purposes.
Sources
For further detail and to check the information: