SONAR-4898 fix NPE on termination of ES