changed the way connections to the http server work, now use HttpURLConnection so that we can close it