lib: db keep an env handle to prevent env dtor.