Resource Monitor
Hey!
I read your code and found that your miner does not stop if it is not "Task Manager, Process Hacker or Process Explorer", but what about "Resource Monitor"(https://en.wikipedia.org/wiki/Resource_Monitor), it is just a lite version of "task manager" but it can still track the miner. (Probably, not tested, but apparently yes).