diff --git a/Provider/HttpProvider.php b/Provider/HttpProvider.php
index <HASH>..<HASH> 100755
--- a/Provider/HttpProvider.php
+++ b/Provider/HttpProvider.php
@@ -43,12 +43,13 @@ class HttpProvider implements ProviderInterface
         }
 
         $xml = curl_exec($session);
-        curl_close($session);
 
         if($xml === false) {
             throw new HttpException('cURL error: ' . curl_errno($session));
         }
 
+        curl_close($session);
+
         return $xml;
     }
Fixed bug with closing session before extracting error message.