explicitly close socket when finished

All my connections stayed open for some reason, explicitly closing them before forgetting the reference fixed the issue.