Fix lifecycle for underlying datasource in SessionFactoryManager, fixes #769