Prevent closing a null curl connection

If the connection isn't open PHP will throw a warning similar to this:

```Warning: curl_close() expects parameter 1 to be resource, null given in...```