United posts smaller loss than anticipated as travel demand picks up