It seems like the bot dies because if you are low hp when acid phase starts and it starts walking towards the backline, it sometimes somehow eats up a fireball and since the bot doesn't eat before he starts walking the line, it simply gets blown up.
The moment I wrote this, it walked straight into one of those big fireball and while trying to eat, he ate another one and died. Honestly at this point I think the script might need some tweaking