Adjusting EXIT_SCRIPT variable declaration in check_exit function