Exit with correct status code