When Magento is performing an upgrade it creates certain files. If something goes wrong during the upgrade, Magento will try to finish upgrade everytime it is called, until those files are gone. Which files are those?
It acts similar to the maintenace.flag file, but that one isn’t responsible for it because I deleted it but Mage kept trying to finish the upgrade process.