def shutdown(self):
        self.shutdownEvt.wait()
        logger = serverLogging.logger
        logger.info('Initiating shutdown...')

        if self.running:
            logger.info('Shutting down main service...')
            asyncBaseServer.BaseServer.shutdown(self)

        # shutdown session manager
        if sessionManager.sm:
            logger.info('Closing session manager...')
            sessionManager.close()
        
        # close database
        if db.db_handle:
            logger.info('Closing database...')
            db.close()

        if Mgt.mgtServer:
            logger.info('Shutting down administation service')
            Mgt.mgtServer.shutdown()

        logger.info('All services have been shut down successfully')
        # shutdown logging
        logging.shutdown()
        self.shutdowninprogress = False
def close():
    sessionManager.close()
    db.close()