regard shutdown order (clean buffer and close elasticsearch client afterwards)