Fix race condition during `mimetypes` initialization.
Fix race condition during `mimetypes` initialization.

Initial patch from Steven R. Loomis.
Closes #8629.

pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac