Use block semantics for io in html formatter.

Closes template files immediately after writing.
Fixes "too many open files" issue when running on large projects.