Reinstate Tempfile finalizer to ensure it is deleted. Fixes #1133