Add SystemExit exception and use it in unix/ and stmhal/ ports.

Addresses issue #598.