The Pantry swings to profit in Q3