code: func (cdb *Writer) Freeze() (*CDB, error) {
  	var err error
  	var index index
  	cdb.finalizeOnce.Do(func() {
  		index, err = cdb.finalize()
  	})
  
  	if err != nil {
  		return nil, err
  	}
  
  	if readerAt, ok := cdb.writer.(io.ReaderAt); ok {
  		return &CDB{reader: readerAt, index: index, hash: cdb.hash}, nil
  	} else {
  		return nil, os.ErrInvalid
  	}
  }
docs: // Freeze finalizes the database, then opens it for reads. If the stream cannot
  // be converted to a io.ReaderAt, Freeze will return os.ErrInvalid.
  //
  // Close or Freeze must be called to finalize the database, or the resulting
  // file will be invalid.