Rite Aid swings to Q2 profit; lifts view