Change the end of your group commands to
and
This tells mirc that it has reached the end of the group commands,
so if group is off it knows where to pick up following the script again.
The beginning of the group commands will toggle between on and off,
with either your popups or typing the command directly.