Exit status fix

The status was returned, but not used in exit.
Here's a fix, including tests.