Create a temporary file object for output, and rename it when done.