Added check for session state before calling router->sessionClose