Stopping File Leak on Gateway Script Restarts from TCP Socket Connection script

@pturmel Sorry I should have included my Ignition version. The gateway is running v8.1.7 and the LifeCycle module I tried was the v8.0 one. I’ve confirmed that on gateway script restarts I find the key ‘thread’ and not just an empty dictionary.

Does anything immediately look wrong with my implementation of interrupting the old thread and waiting for it to end? And same thing for my clean up of the previous socket? I took inspiration for my own implementation from a few forum posts including this one, but still have an issue with file leaks. Managing multiple asynchronous threads - #2 by pturmel