Add with-logical-transaction to simulate nested transactions, commit-hooks, and abort-hooks

This adds a macro called with-logical-transaction which can be nested. At the toplevel, it works like with-transaction; when invoked while a transaction is already in progress, it works like with-savepoint.

It also adds commit-hooks and abort-hooks onto the transaction-handle class, and automatically executes those at the appropriate times.

It also adds an ensure-transaction macro, which starts a transaction only if none is currently in progress.

Note that this changes the lambda list of with-savepoint to be more consistent with with-transaction (and makes the name optional).