Updated missing API's and added cleanup on XMLSocket close