Fix issue with relay firing events after connection is closed