Barnes & Noble swings to profit in Q3