Basically, Ultima Weapon (actually, there are 7(?) "different" Ultima Weapon battle scenes) escapes by using an attack named (Report), which is triggered by several conditions.
Therefore, in order to prevent Ultima Weapon from fleeing, you will have to avert his any usage of (Report). So, deleting the relevant AI that makes him use (Report) will make him not fly away. However, if you do just that, he will become inactive after three turns or so, for he is technically only intended to act for three (?) turns before fleeing.
As a result, your best guess is to find the particular Ultima Weapon script that serves as the final Ultima Weapon scene, the one that has Shadow Flare as its Death Counter script, and copy that.
Tell me if the problem persists.