Tools/connection_patcher: prevent closing window on windows outside of cmd

* should probably be used in all other tools as well
* implementation for unix may be wanted
Assumes console when undecidable (e.g. on non-windows or when winapi calls fail). Likely is a bad idea, but preserves previous behavior.