The Elon Musk-owned company, once a stalwart of Silicon Valley, is set to wave goodbye to the city that birthed it.