code: func (a *Archiver) Close() error {
  	// This is done so asynchronously calling push() won't crash.
  
  	a.closeLock.Lock()
  	ok := false
  	if a.stage1 != nil {
  		close(a.stage1)
  		a.stage1 = nil
  		ok = true
  	}
  	a.closeLock.Unlock()
  
  	if !ok {
  		return errors.New("was already closed")
  	}
  	a.wg.Wait()
  	_ = a.progress.Close()
  	tracer.Instant(a, "done", tracer.Global, nil)
  	err := a.ctx.Err()
  	// Documentation says that not calling cancel() could cause a leak, so call
  	// it, but not before taking the context's error, if any.
  	a.cancel()
  	return err
  }
docs: // Close waits for all pending files to be done. If an error occured during
  // processing, it is returned.