Added socket close code.