Return after an error of the async write operation

Tested on Windows 8 using the on-board and the USB serial
ports and using Qt4 and Qt5.

Change-Id: Idd25b81c9b6b2cd0b94e83fe30e6e7dad4dddfd6
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>