Why was the position closed at the price, which was not on the chart?

By default, the charts of trading instruments in the trading terminal show the Bid price, but not all positions are closed at this price.

Long positions (Buy) are opened at the Ask price and closed at the Bid price. Short positions (Sell), in their turn, are opened at the Bid price and closed at the Ask price.

As a result, on the chart you can see only the Bid price, at which your long (Buy) positions are closed.

It can be easily changed by enabling the Ask line in chart settings.