add bufferedReader closing and socket closing