Hi Marco,
The automated procedure is based however on the use of the optimize command which is the only thing that has not restarted to work yielding
If I got it right, everything works except for the call of OPTIMIZE? In this case, I would recommend to export the database. If this succeeds, your data should be correct. You can also try to call OPTIMIZE ALL, which basically does the same as exporting the data and recreating a new database (ideally, back up your data before optimizing it).
Christian