U.S. stocks closed mostly lower on Friday, largely due to a selloff in energy shares. The S&P 500 energy sectors slumped 2.6%, weighing on the broader index. But all three main benchmarks posted weekly gains. The Dow Jones Industrial Average closed 58.67 points, or 0.2%, lower at 24,753.09, but posted a 0.2% weekly gain. The S&P 500 index fell 6.43 points, or 0.2% to 2,721.33 but ended the week 0.3% higher. Meanwhile the Nasdaq Composite advanced 9.42 points, or 0.1% to 7,433.85 and gained 1.1% over the week. Among the worst performers on the S&P 500, Gap Inc. shares fell 15% as the retailer reported disappointing earnings.