Geralt wished to die alongside Yennefer. Since a djinn can't kill its own master, this wish would provide a nice loophole that would save Yennefer's life and also ensure that Geralt and Yennefer's lives are bound together until their very ends.