Clean up cppcheck-htmlreport

1. Use context managers rather than explicit `close()`.
2. Use quotes consistently.
3. Clean up some pep8 complaints.
4. Avoid colliding names (`stream`).