Fix some memory leaks in HierarchicalClusteringIndex
Merge pull request #2017 from pemmanuelviel:flannMemoryLeak