Buffer up and write to disk at end.

Not very optimal, but will do for now.