Exit with correct code.