MapDBCache: synchronize initialization

This is needed in case multiple threads access the DB for the first time
near-simultaneously. In that case, only one will start creating the DB,
and the other will block until it is ready.