Fix bug JAH-865

Call sys.exit on exception from main loop.

Change-Id: Ie03acbd3b6f493aeb2288c4fbe0062738cc1b75e
Merge commit 'd919090a88bf72a53e997d9a966562e558ebeb32'