ugtrain: reset the terminal if output fails

We've noticed with Warzone 2100 in multiplayer mode on an 8 parties
map that output stops after a while. The same issue has been seen
on the MeeGo 1.2 Harmattan platform where terminal buffers are much
smaller. It could be possible that the game itself changes terminal
settings. Checks if cout output succeeded are completely missing.

Hence, add a check if output fails and if it fails, reset the
terminal by invoking the 'reset' shell command.

Fixes: GitHub issue #2.