Update APISession.java - public void Terminate() 

Splitted code in Try-catch block to ensure execution even if one of the previous commands trows an exception.
Extended debug logging.