Fixed socket open issue on program exit.