Try to exit with the right code.