You must only search, read and understand the in
HttpOpenRequest documentation which says:
"After the calling application finishes using the HINTERNET handle returned by WinHttpOpenRequest, it must be closed using the WinHttpCloseHandle function."
WinHttpCloseHandle(hRequest);
hRequest = 0;
I leave it to you to find the closing of the connection handle yourself. ;-)