Shares of Boeing rose nearly 10% to a record high on Wednesday, bolstered by strong demand for air travel and ongoing cost cutting efforts.

During the second quarter Boeing (BA)recorded a net profit of $1.76 billion on earnings, compared to a $234 million loss during the same period a year ago. The stock is up nearly 65% since Dennis Muilenburg, the company's chief executive, took over in July 2015. Shares closed at $233.45 on Wednesday.

Earnings beat Wall Street estimates and the company raised its guidance, earning the world's largest aircraft manufacturer high marks.

"This is about as close to perfect as it gets from Boeing," wrote Rob Stallard of Vertical Research Partners in a research note.

Related: Boeing factory where Trump delivered jobs speech to lay off 200 workers

With the strong results, Boeing announced it would make four years worth of contributions to its retiree pension fund over the next three months.

The company will put $3.5 billion worth of shares into the pension fund. As a result, it won't have to make any more mandatory payments again until 2021. The company also walks away with a $700 million tax benefit from its increased contributions.

"If we weren't performing at the levels we're at, we wouldn't have the opportunity to do something like this," said Boeing Chief Financial Officer Greg Smith.

Boeing has been steadily moving away from defined benefit retirement plans, which provide a fixed, pre-established pension or retirement payment, and are often more costly for employers to maintain than other types of plans. Last year, Boeing shifted most of its unionized and nonunion workforce to a defined contribution 401(k) plan.

As of the the end of June, Boeing's pension fund was on the hook for $19.7 billion.

The company raked in $4.5 billion in free cash flow during the second quarter and raised its operating cash flow guidance by $1.5 billion, to $12.25 billion, thanks to increasing production and sales of its most popular commercial jetliners.

Boeing's leadership has also promised to return nearly all of its free cash flow to investors by buying back its shares or increasing its dividend. The company said on Wednesday it was buying back $10 billion worth of stock this year, an increase of $3.5 billion.

Related: Boeing reorganizes into three parts: Airliners, fighters and spare parts

Boeing's top executives say its ability to generate cash is significant enough to satisfy shareholders and fund enormous new jetliner development programs like its 777X as well as a possible new twin-aisle jet the industry is already calling the 797.

The company has been reorganizing, cutting costs, and aggressively renegotiating new contracts with its suppliers.

Boeing has shed more than 15,000 jobs since the beginning of 2016 through retirements, buyouts and, more recently, layoffs at plants in Washington state and South Carolina. The company employs about 144,000 people globally.

Boeing is working to deliver on a backlog of 5,700 jetliners worth $424 billion. Most of those are its smaller, single-aisle aircraft, the 737 Max.