only close the session if it is active