cURL request was not being closed, fixed