Quitting session through programmatically is not closing the session some times.
First it checks whether connection to server is active or not to close the session. It is depending on isConnectionActive variable to check the connection is active or not. Right now we are setting isConnectionActive to true only if user calls getClient(). isConnectionActive should be set to true when user calls setClient(client).