J.C. Penney slows declines in Q2, swings to profit