Make sure we're not about to deref a NULL pointer
stat the directory, not data.mdb, to determine max DB size

If data.mdb doesn't exist (which it won't when, for instance, we're starting
a whole new DB), you'll never get a save.  That's kinda sucky.
Flush keys to NDS before doing a KEYS

That way, we can walk the NDS datastore in confidence that everything we
might need to look at it is in one place.  Yes, it'll slow down the KEYS
command even more, but if you're worried about performance, you're not
going to be running KEYS in the damned first place.