Fix EZP-21599: remaining transaction from content/publish operation

http://jira.ez.no/browse/EZP-21599

See #767 for a better fix.

### Situation
When the publish/before trigger interrupts the operation, the transaction counter is still at level 1 instead of 0, because of the extra transaction added to the operation body.

### This patch
This patch will do what we did where the code is called to prevent errors: commit every transaction that was left while the operation was executed.

### Testing
1. Make sure you have a pre-publish workflow with an event that will interrupt publishing (approve, wait-until-date...)
2. Store the content without publishing it
3. Publish it using eZOperationHandler::execute( 'content','publish' ) in a command line script
4. Check eZDB::instance()->transactionCounter after the operation. If it is bigger than it was before running the script, here is the bug.

### Issues
This is plain ugly. If an uncommited transaction is forgotten in a custom workflow event, the system will cleanly close it.
Alternative PR: https://github.com/ezsystems/ezpublish-legacy/pull/767.