Elon Musk threatened to stop advising President Donald Trump if the White House withdraws from the Paris climate deal.