Fix array index issue on WIN32 when unable to connect to the serial port