It's possible for Target to be NONE if the reason the effect finished was because the player left the 5-spell radius where the npc is and the npc despawned. In this case, you'll get " Error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type".
Simply added a check to make sure the target exists first.

Attached Files:
magiceffectshadersonendscript.psc