Fix 227329c8e1fb818548f1936f5dc1349ffd73352

mdb_dbi_close() must allow any dbi < maxdbs, since opens in an
uncommitted txn don't increment env->me_numdbs.
ITS#7570 fix MDB_GET_MULTIPLE and MDB_NEXT_MULTIPLE
Revert "ITS#7570 fix MDB_GET_MULTIPLE and MDB_NEXT_MULTIPLE"

This reverts commit 372b3ddb85bef953fb548fbf2b9ef0cba4e3c8ed.

Original code works as designed.
Fix mdb_rebalance

Need to check NUMKEYS as well as fill threshold, when deciding
whether to change anything. Don't let the page drop below the
minimum number of keys.
fix prev commit
ITS#7574 blind fix

Fix 227329c8e1fb818548f1936f5dc1349ffd733523, don't persist
the MDB_VALID bit in db.md_flags.
Fix mdb_rebalance

Don't do anything with (fake root) subpages
Clean up MDB_env setup.

Malloc before I/O. Avoids possible malloc error after I/O.
Don't allocate dirty & free lists when MDB_RDONLY.
Factor out code.
Cleanup for TLS key and read-only filesystem.

Move key init into mdb_env_setup_locks().
Don't create unused TLS key when read-only filesystem.
Drop internal flag MDB_ROFS, we can instead test either
!me_txns, !mt_u.reader or me_lfd==INVALID_HANDLE_VALUE.
Support mdb_txn_abort(a reset txn).
Catch MDB txn reuse/sync errors.
Add MDB_NOTLS envflag.
Tweak comments/readability.

Show MDB_PERSISTENT/MDB_VALID/DB_VALID relationship.
mdb_txn_renew0(): Remove obsolete "cannot fail" comment.
Fix typo from 7aba5f5ab92a3fa92de001edb2c5ff4b04fd7d0d
Fix MDB_LAST, reset cursor index