The disconnect() method of the HttpURLConnection class closes the connection to the web server.
disconnect()
HttpURLConnection
Needed for HTTP/1.1 Keep-alive