rama is just a name and form in human body of that "formless" supreme self. .so whoever is born are bound to die as for as this body is concerned..do you think, when rama can just by a touch of his hand give moksha to Sabari and stone turned agaligai, couldn't have saved himself from death???he is just following the rules..that's all.
The same supreme-self came back in human form as krishna also. krishna also died due to a arrow sent by a hunter.do you think krishna couldn't have saved himself when he can lift a govardhan with a finger???again, they just follow the rules..ultimately, all are same..only name and forms are different..that's all.