Fix possible static initialization order problem/leak of a mutex

As a side effect, the Init() and Shutdown() functions are
no longer thread safe.
Ignore PVS-Studio cruft