Most (all but the DB2 script) of the database upgrade scripts that are version 25 identify themselves as version 24, causing Openfire to think that a new database script needs to be installed at every boot. This causes a new index to be created, repeatedly. As the index is created by name, I am assuming that this either overwrites a previous index, or fails.
This affects updating users only. The installation script that is used for new installations updates the version number correctly.
To work around this bug manually, execute the following SQL query on your database. Make sure to do this after Openfire 4.1.0 was started (to allow the update script to be executed at least once)
This will prevent the update script from running again.