Added locking to serial ports on posix.