The S&P 500 is on track for its worst monthly performance since March, despite a rally in the last week.