The legal battle between Elon Musk and OpenAI has ended in a win for the company he co-founded, following a jury decision.