Write the buffer earlier for item with a "count by"
Write the buffer earlier for item with a "count by"

This avoids situations where all the items of a type have been
generated, but the buffer isn't full so they'll be written only
at the end, but other items depend on them (via a variable for
instance).

novafloss/populous