Add a function to flush all accumulated buffers.