Tesla turns a profit in what Musk calls ‘a historic quarter’