Fix switching to slide in Viewer.

- Refactored switch_to method in app.py