Exit code is being given on exit event