HttpClient and related resources are being closed properly now, added some configuration options regarding API connection.