code: func (w *PackWriter) Close() error {
  	defer func() {
  		if w.Notify != nil && w.writer != nil && w.writer.Finished() {
  			w.Notify(w.checksum, w.writer)
  		}
  
  		close(w.result)
  	}()
  
  	if err := w.synced.Close(); err != nil {
  		return err
  	}
  
  	if err := w.waitBuildIndex(); err != nil {
  		return err
  	}
  
  	if err := w.fr.Close(); err != nil {
  		return err
  	}
  
  	if err := w.fw.Close(); err != nil {
  		return err
  	}
  
  	if w.writer == nil || !w.writer.Finished() {
  		return w.clean()
  	}
  
  	return w.save()
  }
docs: // Close closes all the file descriptors and save the final packfile, if nothing
  // was written, the tempfiles are deleted without writing a packfile.