Deleting or closing an index doesn't clean the memory properly
fixes #3232