arch: Use tempfile module to create temporary directory
It ensures created temporary directories will be removed once they are no longer needed.