Why is my profit or loss different before and after I close a position?