Re #9398. Exit script and fail build if a command fails.

This is specifically indended to exit and fail the build if a unit
test fails. Currently the job continues and it's only the parsing of
the unit test output that turns the build to unstable.
We want it to fail in this situation.
Re #8398. Missed out check for failure on first ctest call.
Merge remote-tracking branch 'origin/bugfix/9398_windows_jenkins_test_fail_builds'