Fix #10127 (crash on parallel rendering of spatialite layers)

There was a run condition in connection pool singleton: at the beginning,
the singleton got initialized twice. Now the singleton is handled
as a static function variable which should be initialized in thread-safe way.