Office Max swings to profit in Q4 on cost controls