# Buggy code
async def _cleanup(self) -> None:
    for rule_name, rule_id in self._rules.items():
        logger.debug("Removing rule {0}, ID: {1}".format(rule_name, rule_id))
        try:
            await self._bus.delMatch(rule_id).asFuture(self.loop)
        except Exception as e:
            logger.error(
                "Could not remove rule {0} ({1}): {2}".format(rule_id, rule_name, e)
            )
    self._rules = {}
    await asyncio.gather(*(self.stop_notify(_uuid) for _uuid in self._subscriptions))


# Traceback (txdbus.error.RemoteError)
INFO:bleak.backends.bluezdbus.client:605: GATT Char Properties Changed: gorg/bluez/hci0/dev_F2_1F_2B_52_48_9E/service000e/char0017 | [{'Value': [23, 8, 160]}, []]
DEBUG:bleak.backends.bluezdbus.client:597: DBUS: path: gorg/bluez/hci0/dev_F2_1F_2B_52_48_9E/service000e/char0017, domain: org.bluez.GattCharacteristic1, body: {'Value': [2, 188, 1, 83]}
INFO:bleak.backends.bluezdbus.client:605: GATT Char Properties Changed: gorg/bluez/hci0/dev_F2_1F_2B_52_48_9E/service000e/char0017 | [{'Value': [2, 188, 1, 83]}, []]
DEBUG:bleak.backends.bluezdbus.client:597: DBUS: path: gorg/bluez/hci0/dev_F2_1F_2B_52_48_9E, domain: org.bluez.Device1, body: {'ServicesResolved': False, 'Connected': False}
DEBUG:bleak.backends.bluezdbus.client:622: Device F2:1F:2B:52:48:9E disconnected.
DEBUG:bleak.backends.bluezdbus.client:149: Removing rule PropChanged, ID: 1
DEBUG:bleak.backends.bluezdbus.client:166: Disconnecting from BLE device...
Traceback (most recent call last):
[...]
File "/home/sfrank/.local/lib/python3.5/site-packages/bleak/backends/bluezdbus/client.py", line 168, in disconnect
await self._cleanup()
File "/home/sfrank/.local/lib/python3.5/site-packages/bleak/backends/bluezdbus/client.py", line 156, in _cleanup
*(self.stop_notify(_uuid) for _uuid in self._subscriptions)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self  # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/home/sfrank/.local/lib/python3.5/site-packages/bleak/backends/bluezdbus/client.py", line 529, in stop_notify
).asFuture(self.loop)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self  # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
txdbus.error.RemoteError: org.bluez.Error.Failed: No notify session started

# Fixed code
async def _cleanup(self) -> None:
    for rule_name, rule_id in self._rules.items():
        logger.debug("Removing rule {0}, ID: {1}".format(rule_name, rule_id))
        try:
            await self._bus.delMatch(rule_id).asFuture(self.loop)
        except Exception as e:
            logger.error(
                "Could not remove rule {0} ({1}): {2}".format(rule_id, rule_name, e)
            )
    self._rules = {}

    for _uuid in list(self._subscriptions):
        try:
            await self.stop_notify(_uuid)
        except Exception as e:
            logger.error(
                "Could not remove notifications on characteristic {0}: {1}".format(
                    _uuid, e
                )
            )
    self._subscriptions = []