Tesla reaches deal after China halts sales of Model 3