Fix Elasticsearch client close bug