finalize() {
    if (this._state.aborted) {
      var abortedError = new ArchiverError("ABORTED");
      this.emit("error", abortedError);
      return Promise.reject(abortedError);
    }
    if (this._state.finalize) {
      var finalizingError = new ArchiverError("FINALIZING");
      this.emit("error", finalizingError);
      return Promise.reject(finalizingError);
    }
    this._state.finalize = true;
    if (this._pending === 0 && this._queue.idle() && this._statQueue.idle()) {
      this._finalize();
    }
    var self = this;
    return new Promise(function (resolve, reject) {
      var errored;
      self._module.on("end", function () {
        if (!errored) {
          resolve();
        }
      });
      self._module.on("error", function (err) {
        errored = true;
        reject(err);
      });
    });
  }
Finalizes the instance and prevents further appending to the archive
structure (queue will continue til drained).

The `end`, `close` or `finish` events on the destination stream may fire
right after calling this method so you should set listeners beforehand to
properly detect stream completion.

@return {Promise}