Her death was the only way to save the galaxy. On top of that, Cosmo had been searching for her destiny, and in that moment she finally found it.