Trust me, Y/N is not dead. what you're seeing is Y/N personified in his dreams. JK has amnesia and forgot that Y/N was an actual person that existed and that he loved. This is because he developed the heartbreak syndrome. But no one is dead. I hope this clears it up for you.