Simplify and improve the QSP::TimeoutError handling

It is reasonable to get rid of duplicating a code of TimeoutError
handling. A common parts of a code can be moved to one place.
Also, can be improved some of related if/else conditions.

Tested on Windows 8 and Linux with virtual serial ports.

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