Fix part of #11: transactions track and close cursors.