Fix creating a new session id when the previous session id is invalid or non existant
Don't log end session event if session isn't open