Allow writing a container multiple times.

We still only format/build the result once, but we now cache the result
and re-use it on subsequent calls to #write.

Closes #155.
Merge pull request #163 from esnext/multiple-write-calls-fix

Allow writing a container multiple times.