code: func (e *encoder) Close() error {
  	// If there's anything left in the buffer, flush it out
  	if e.err == nil && e.nbuf > 0 {
  		e.enc.Encode(e.out[:], e.buf[:e.nbuf])
  		_, e.err = e.w.Write(e.out[:e.enc.EncodedLen(e.nbuf)])
  		e.nbuf = 0
  	}
  	return e.err
  }
docs: // Close flushes any pending output from the encoder.
  // It is an error to call Write after calling Close.