Use _exit instead of exit

fixes #6820