It's not the red lines disappearing that determines whether or not you get hit.
If you are inside the red lines at the end of the spell cast you are going to get hit !!!!!
If you're not inside, but cast a spell or skill while inside the red lines (even if you started it before the red lines appeared), screw you, you're going to die unless you can, somehow, recast a instant spell when outside.