in reply to Check if a process is running on Windows
Are you running the script/program as a service? I have recently stumbled upon this article and thought it might help.
(I hope you will pardon this response if it appears naive.)
Please forgive me for earlier sending you the above link to an article which I only later on discovered to be available only to subscribers of the website. Anyway, for whatever it was worth, the basic idea at least was there. Hope that helps.