US stocks close Friday lower, but indexes post weekly gains