Adds ability to flush the transactions and receive a callback when it is complete.