By default, the order of closing positions is to flatten the old warehouse (the earliest warehouse) first, and then flatten the new warehouse. The first time A bought 1 lot, and then B bought 2 lots. If you choose to close 2 lots, the closing order is 1 lot bought at A price and 1 lot bought at B price.
If you want to display them separately, please change the software.