/window -g is not meant to control flashing.

You may want to disable this in the options:
IRC > Options > 'Flash on message'

Then change your open event to /flash -r20 $nick