Profit/Loss for buy(long) position
When you close a buy(long) position, your Profit/Loss(P/L) is calculated according current bid price and your open price. Because you need to sell your asset to a buyer, and bid price is what a buyer is willing to pay for it.
Profit/Loss for sell(short) position
When you close a sell(short) position, your P/L is calculated according your open price and current ask price. Because you need to buy the asset from a seller, and the ask price is what a seller is willing to take for it.