Added changes to call callBackEndSync only when all SQL transaction has been commited

The problem with the actual implementation is that the user clicks the big "Sync Now" button on the mobile web app, and it gets control back BEFORE all changes are actually on the db (all websql are async)

This commit fixes that, so the end callback is called only when the websql transaction is actually finished.