def METHOD_NAME(self):
    """Closes all active devices, in the opposite order as they were
    requested."""
    for _desc, dev in reversed(self.active_devices):
        try:
            if isinstance(dev, (Client, BestEffortClient)):
                dev.close_rpc()
            elif hasattr(dev, "close"):
                dev.close()
        except Exception as e:
            logger.warning("Exception %r when closing device %r", e, dev)
    self.active_devices.clear()