code: func (p *Processor) Finish() *annotation.State {
  	// Finish our step handlers.
  	var closeTime *timestamp.Timestamp
  	if !p.astate.Offline {
  		// Note: p.astate.Clock is never nil here, see astate setup in New().
  		closeTime = google.NewTimestamp(p.astate.Clock.Now())
  	}
  	for _, h := range p.stepHandlers {
  		p.finishStepHandler(h, p.o.CloseSteps, closeTime)
  	}
  
  	// If we're initialized, shut down our annotation handling.
  	if p.annotationStream != nil {
  		// Close and reap our annotation meter goroutine.
  		close(p.annotationC)
  		<-p.annotationFinishedC
  
  		// Close and destruct our annotation stream.
  		if err := p.annotationStream.Close(); err != nil {
  			log.WithError(err).Errorf(p.ctx, "Failed to close annotation stream.")
  		}
  		p.annotationStream = nil
  	}
  
  	return p.astate
  }
docs: // Finish instructs the Processor to close any outstanding state. This should be
  // called when all automatic state updates have completed in case any steps
  // didn't properly close their state.
  //
  // Finish will return the closed annotation state that was accumulated during
  // processing.