Replace some exit(n) calls with stg_exit(n); fixes trac #4445