Finish the race against the time by going to the chest, back to the switch in the city, and leave the city area through the dungeon until you're in safety.
What you have to do depends on how far you're with there events, but there is a step by step guide in the wiki:
Ryoko: https://renryuu.miraheze.org/wiki/Ryoko#Character_events_sequence
Elly: https://renryuu.miraheze.org/wiki/Elly#Character_events_sequence