Losses on Thursday and Friday did little to overturn an advance that was led by banks, oil companies and other beaten-down industries