Reliably close streams in a few corner cases
Trivial inspection fixes