You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bundle_archive_writer.go
    path of file: ./repos/werf/pkg/deploy/bundles
    
    the code of the file until where you have to start completion: package bundles

import (
	"archive/tar"
	"bytes"
	"compress/gzip"
	"fmt"
	"io"
	"os"
	"time"

	"github.com/google/uuid"
)

type BundleArchiveWriter interface {
	Open() error
	WriteChartArchive(data []byte) error
	WriteImageArchive(imageTag string, data []byte) error
	Save() error
}

type BundleArchiveFileWriter struct {
	Path string

	tmpArchivePath   string
	tmpArchiveWriter *tar.Writer
	tmpArchiveCloser func() error
    
func (writer *BundleArchiveFileWriter) WriteImageArchive(imageTag string, data []byte) error {
	now := time.Now()
	buf := bytes.NewBuffer(nil)
	zipper := gzip.NewWriter(buf)

	if _, err := io.Copy(zipper, bytes.NewReader(data)); err != nil {
		return fmt.Errorf("unable to gzip image archive data: %w", err)
	}

	if err := zipper.Close(); err != nil {
		return fmt.Errorf("unable to close gzip image archive: %w", err)
	}

	header := &tar.Header{
		Name:       fmt.Sprintf("images/%s.tar.gz", imageTag),
		Typeflag:   tar.TypeReg,
		Mode:       0o777,
		Size:       int64(len(buf.Bytes())),
		ModTime:    now,
		AccessTime: now,
		ChangeTime: now,
	}

	if err := writer.tmpArchiveWriter.WriteHeader(header); err != nil {
		return fmt.Errorf("unable to write image %q header: %w", imageTag, err)
	}

	if _, err := writer.tmpArchiveWriter.Write(buf.Bytes()); err != nil {
		return fmt.Errorf("unable to write chart.tar.gz data: %w", err)
	}

	return nil
}