Handle error in renewing session by logging out

Also made it possible to log out by triggering an event