Tesla will close stores, lay off staff as carmaker goes online