But if afterlife and god don't exist, when he died, he would not go anywhere, the life of his body would simply end, and he would have never gotten the answer.
Therefore, the fact that the genie killed him serves as a confirmation that, at least, afterlife exists. There he would get the answer if god exists (and if yes, which of the religions was right).
The question that must never be answered...
in case you didn't get it he killed him so he would know (afterlife or not)
But if afterlife and god don't exist, when he died, he would not go anywhere, the life of his body would simply end, and he would have never gotten the answer.
Therefore, the fact that the genie killed him serves as a confirmation that, at least, afterlife exists. There he would get the answer if god exists (and if yes, which of the religions was right).