Fix the waitForBytesWritten() behavior on Windows

The slot _q_completeAsyncWrite(), which is used inside of
waitForBytesWritten(), returns void. To define the status
of write completion method was used the last error code,
where any value are not equal to NoError was interpreted
as an error.

But this behavior was incorrect because the error code
number could be set by any other previous I/O operation
and remained not cleared. Therefore waitForBytesWritten()
always returns false.

A good solution it is to compare size of the writeBuffer
after completion of each write operation with zero, because
the buffer should be empty.

Tested on Windows 8 with the on-board and the USB serial
ports and the cwritersync example using Qt5.

Task-number: QTBUG-36758
Change-Id: I2cf6f9e08056d2e237211b19cff59990aac53bc1
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>