On windows (my knowledge is up until windows10), without putting a strict policy for all cmd windows, you can't forbid closure of any python related cmd windows like anaconda prompt when the user closes them via exit button [x]. editing activate.bat of anaconda prompt, using powershell, using autohotkey (except for preventing Alt+F4 for closing the prompt), using GUI simulators like tkinter were all useless in my case to forbid closing cmd windows. So I believe, without putting a strict policy (Windows Group Policy) for all cmd's which sounds very limiting and even dangerous, you better just accept the risk and be careful when you use a time consuming python process on windows.