While reviewing unrelated code, I realized we leak the connection objects when doing: https://github.com/ARM-software/devlib/blob/228baeb317a038b8e61a7d9c7710e6f13b0f7163/devlib/utils/ssh.py#L373 ``` atexit.register(self.close) ``` This should be fixable with a [WeakMethod]( https://docs.python.org/3/library/weakref.html#weakref.WeakMethod ), and the `callback` used to call [atexit.unregister()](https://docs.python.org/3/library/atexit.html#atexit.unregister)