the web server normally will send a sockclose command when it has finished sending the requested page. However you are correct in that a failed connection will then leave the socket open.
adding a timer into the text event can close the socket if its left open.
Code:
on *:TEXT:!top10:#: set %chan $chan | sockopen topten www.deepsky.ws 80 | .timertopten 1 30 sockclose topten