I have just solved this with the following solution, please let me know if it is correct way or not. Thanks.
in my ui class (that inherites from a designer ui py file) I placed this function to catch the close event and issue a kill all to my worker managers (one set are providing a camera snapshot feed and the other is inference engines):
def closeEvent(self, event):
print('x button clicked')
I then had an issue of it bugging when closing. I found out I had to store the app in a variable and pass it to sys exit (I still dont fully understand why! but it works):
app.exec_() changed to:
app_ref = app.exec_()
Now when I click the top right X it kills the workers and exits error free.