Close session in API