(#2951) - fix concurrency in leveldb.js

So I figured out where the bug was coming from - I had
not implemented the writeLock correctly. Took this opportunity
to also use the `double-ended-queue` as suggested by
@calvinmetcalf.
dunno if this is necessary, but it makes me feel better