Fix bugs related to opening a transaction.
Update the test code to test creating a new transaction