That is probably because the selected object when the process is called is the player, so when they leave the process stops. If there are no players on the plot all threads will stop aswell.
Also, you could compact this to two code blocks per by making the repeat it's own function, then when you need it set the function list and call the function