Man tried to get into cockpit on American Airlines flight: officials