I like to think of it this way:
For example, the pair is USD/CAD
When you buy the pair, it's like you are buying USD with borrowed CAD. If USD goes up against the CAD when you close, then you are repaying the CAD back with more USD than you started.
***(oops, revised)***
When you sell the pair, it's like you are borrowing USD to buy CAD. If USD goes down against the CAD when you close, then you repay the USD with more CAD than you started.
Hope that helps
