finishLazyStructWriting = lazyWriter => {
  flushLazyStructWriter(lazyWriter); // this is a fresh encoder because we called flushCurr

  const restEncoder = lazyWriter.encoder.restEncoder;
  /**
   * Now we put all the fragments together.
   * This works similarly to `writeClientsStructs`
   */
  // write # states that were updated - i.e. the clients

  encoding.writeVarUint(restEncoder, lazyWriter.clientStructs.length);

  for (let i = 0; i < lazyWriter.clientStructs.length; i++) {
    const partStructs = lazyWriter.clientStructs[i];
    /**
     * Works similarly to `writeStructs`
     */
    // write # encoded structs

    encoding.writeVarUint(restEncoder, partStructs.written); // write the rest of the fragment

    encoding.writeUint8Array(restEncoder, partStructs.restEncoder);
  }
}
Call this function when we collected all parts and want to
put all the parts together. After calling this method,
you can continue using the UpdateEncoder.

@param {LazyStructWriter} lazyWriter