You can run a test though :
Enter in battle, open the memory viewer of vba, go to the address 0203e330, use tailwind, it should trigger some bytes in this area. Then flee the battle and tell me if it's cleared. If it is, it's the loop that is incorrect, if it is not, well, it has to be cleared
Seems to me like the free ram isn't properly cleaned at the end of the battle, which is weird because I remember having checked this hundred of times.
For this one only KDS can help you as I don't have the means to test the code/correct it since I am on tablet