American Airlines to buy TWA