Added serial port opening error handling and serial port configuration