Tesla shares took a hit after the electric vehicle maker announced that it would lay off more than 10% of its global workforce.