Querying using RavenPersistence within ambient transaction causes Exception

When the EventStore is configured to use RavenDB for persitence and the EnlistInAmbientTransaction option is set, querying within an ambient transaction results in a System.Transactions.TransactionAbortedException exception being thrown.

I believe the reason is the TransactionScope used for querying in the RavenPersistenceEngine (which in this case is a nested transaction), is not being completed before it is disposed, which results in the outer transaction being aborted.

I created a test-case which replicated the problem, and a fix which resolves it.