infinite exit loop resolved for exiting app