Thanks for posting the question @fot, Internally when constructing the TPCStore, we have a TCPStoreWorkerDaemon to bind the ports and do create creation, so when it goes out of scope and no reference to the TCPStore created, we will call the destructor automatically and release the port resources.
Could you elaborate more on how you get the error? If you did Ctrl-C on one process, there might be hanging processes still have TCPStore as it does not have master to send the destruction signals. In this case you might need to manually kill those hanging processes. You can do it by inspecting what ports your training_script binded to by using $(ps aux | grep training_script.py | grep -v grep | awk '{print $2}') , then kill them