Wall St. ends higher but indexes post weekly losses