code: func (e *Encoder) Close() error {
  	// go back and write total size
  	if _, err := e.w.Seek(4, 0); err != nil {
  		return err
  	}
  	if err := e.AddBE(uint32(e.WrittenBytes) - 8); err != nil {
  		return fmt.Errorf("%v when writing the total written bytes", err)
  	}
  	if _, err := e.w.Seek(22, 0); err != nil {
  		return err
  	}
  	if err := e.AddBE(uint32(e.frames)); err != nil {
  		return fmt.Errorf("%v when writing the total of frames", err)
  	}
  	// rewrite the audio chunk length header
  	if e.pcmChunkSizePos > 0 {
  		if _, err := e.w.Seek(int64(e.pcmChunkSizePos), 0); err != nil {
  			return err
  		}
  		chunksize := uint32((int(e.BitDepth)/8)*int(e.NumChans)*e.frames + 8)
  		if err := e.AddBE(uint32(chunksize)); err != nil {
  			return fmt.Errorf("%v when writing wav data chunk size header", err)
  		}
  	}
  	// jump to the end of the file.
  	e.w.Seek(0, 2)
  	switch e.w.(type) {
  	case *os.File:
  		e.w.(*os.File).Sync()
  	}
  	return nil
  }
docs: // Close flushes the content to disk, make sure the headers are up to date
  // Note that the underlying writter is NOT being closed.