Added handling of error event, where the Arduino port would be unavailable, leading to a crash.