Adds synchronicity to transaction commits

The main effect of this is that tx.commit() on the client
won't call back until the transaction has been fully
committed in the database.

This is a dirty fix. To properly implement this we will
have to change how transaction commit SQL is executed.