First of all, your question is absolutely correct. Because once you close your position in normal trading, your margin will be refunded to you, and of course your profit and loss will be deducted. As you said above, it is estimated that there are some problems in your simulation system, and the information feedback is not timely (this situation is sometimes encountered in real transactions, which will cause losses to traders, but this probability is extremely small, and customers will have such related contents when signing futures risk disclosure books when opening accounts. It may also be that you didn't close the deal soon after you placed the liquidation order, and the order you placed has been submitted to the unfinished stage, so the funds have not been returned. The trading margin will not be returned until the position is closed.
In other words, as long as you close your position, your deposit will be returned to you soon.