Why did Ben have to die?

And Rey shouldn’t be the one to continue on the Skywalker name. Please don’t downvote me on this, but I don’t see the logic closing Ben’s character when it finally opened up to the light.