Use common TempDirectory
Add some descriptive comments
Ensure stream is closed