Keep page tree current with Kids and Count so it always reflects current state.
Reposition file pointer before writing in case there was an interleaving read.
This is still not 100% correct, but it's closer.