KVDB: Fix bug with nested waiting of empty transaction