How to fix RuntimeError: Session is closed in Python | DevErrors