Once had a LotA run where Behemoth managed to cast Meteor as he died.

Turns out, all the rocks immediately despawn after his health runs out. So. With the cast complete and the spell going off, while all the rocks despawned....

Yeah. Complete alliance wipe, despite the boss being dead. Treasure boxes spawning and everything. Pretty funny.

This probably doesn't relate to your own situation very well. But, point is, sometimes a cast can still manage to hit as an enemy dies. Computers aren't perfect.