fixed when get 401 , fclose  Socket will fail and $matches may get null