Court upholds ruling for Musk over Tesla-SolarCity deal