Add withTransaction for automatic rollback on errors

Thanks @jhickner for his code proposal, and @paul-r-ml for his feature
request.

Fixes #33