code: func writeBackupStreamFromTarAndSaveMutatedFiles(buf *bufio.Writer, w io.Writer, t *tar.Reader, hdr *tar.Header, root string) (nextHdr *tar.Header, err error) {
  	var bcdBackup *os.File
  	var bcdBackupWriter *winio.BackupFileWriter
  	if backupPath, ok := mutatedFiles[hdr.Name]; ok {
  		bcdBackup, err = os.Create(filepath.Join(root, backupPath))
  		if err != nil {
  			return nil, err
  		}
  		defer func() {
  			cerr := bcdBackup.Close()
  			if err == nil {
  				err = cerr
  			}
  		}()
  
  		bcdBackupWriter = winio.NewBackupFileWriter(bcdBackup, false)
  		defer func() {
  			cerr := bcdBackupWriter.Close()
  			if err == nil {
  				err = cerr
  			}
  		}()
  
  		buf.Reset(io.MultiWriter(w, bcdBackupWriter))
  	} else {
  		buf.Reset(w)
  	}
  
  	defer func() {
  		ferr := buf.Flush()
  		if err == nil {
  			err = ferr
  		}
  	}()
  
  	return backuptar.WriteBackupStreamFromTarFile(buf, t, hdr)
  }
docs: // writeBackupStreamFromTarAndSaveMutatedFiles reads data from a tar stream and
  // writes it to a backup stream, and also saves any files that will be mutated
  // by the import layer process to a backup location.