Properly closes and re-opens the session upon a session id set.