(#3113) - Make leveldown an optional dependency

Possible alternative for #3113, main difference is:
- other leveldb backends (e.g. memdown) are supported
- wraps the try/catch statement in an IIFE to prevent the whole file from getting de-optimized