reftable/writer: refactorings for `writer_flush_nonempty_block()`