Apple invests $500 million in rare earths company