message: fix: Mqtt client not closing correctly
diff: @@ -245,13 +245,17 @@ MqttClient.prototype.close = function (cb) {
  return new Promise((resolve) => {
  this.closed = true
  - if (this.client) {
  + if (this.client && (this.client.connected || this.client.reconnecting)) {
  this.client.end(() => resolve())
  - this.removeAllListeners()
  - this.client.removeAllListeners()
  } else {
  resolve()
  }
  +
  + this.removeAllListeners()
  +
  + if (this.client) {
  + this.client.removeAllListeners()
  + }
  })
  }
  