Enhanced disposing/detached handling for TemporaryFile.