Use error values instead of crashing

Return errno instead of crashing on I/O errors with the serial port.