how can i close each socket only 1 time at the end of sockread?