How to automatically reconnect when disconnected on Windows