Auto Closing of Server after Update

May I ask as to how to enable the closing of prodigy after the update of annotations? I have already enabled "instant_submit" in config. So I would like my update function in my custom recipe to trigger the auto closing of the prodigy server.
I cant send subprocess.kill() as it would end both my subprocess(prodigy) and my main process as well.
I can taskkill the pid process but it would result in a improper close and the server port would still be in use, even though the subprocess had ended.


Hi! An approach like this one should work if you want to stop the server and it should free up that port again as far as I know: