diff --git a/pkg/controller/backup_controller.go b/pkg/controller/backup_controller.go index 0a85703a0..e70f1b537 100644 --- a/pkg/controller/backup_controller.go +++ b/pkg/controller/backup_controller.go @@ -440,6 +440,9 @@ func persistBackup(backup *pkgbackup.Request, backupContents, backupLog *os.File if err := json.NewEncoder(gzw).Encode(backup.VolumeSnapshots); err != nil { errs = append(errs, errors.Wrap(err, "error encoding list of volume snapshots")) } + if err := gzw.Close(); err != nil { + errs = append(errs, errors.Wrap(err, "error closing gzip writer")) + } if len(errs) > 0 { // Don't upload the JSON files or backup tarball if encoding to json fails.