Enclose all inserts/updates in one transaction so that the storage layer
 is fast enough to follow packet tracing.
Fix a hang in select when no event is waiting on the queue when closing down
 the storage layer.