US stocks ended the week at record highs supported by Apple's gains