Tesla reaches deal to keep 5 N.Y. stores