Fix stage sorting crashing when detecting loop
Fix stage sorting crashing when detecting loop

  - Avoid handling the stage closing the loop twice

hpicgs/gloperate,hpicgs/gloperate,j-o/gloperate,cginternals/gloperate,hpicgs/gloperate,j-o/gloperate,cginternals/gloperate,hpicgs/gloperate,cginternals/gloperate,hpicgs/gloperate,j-o/gloperate,j-o/gloperate,cginternals/gloperate