Clean temporary file handling for metadata generation, and add test.
This uses a context-manager instead of manually handling removing the file.
Depends on D2465.
Migrated from D2469 (view on Phabricator)
This uses a context-manager instead of manually handling removing the file.
Depends on D2465.
Migrated from D2469 (view on Phabricator)