dispose sql_client in main thread