Opponent leaves the game while loosing the game, but I end up loosing?
Sounds like a classic "temporary disconnect". Happens often enough that they wrote a couple of articles about it, Next time an opponent is taking too much time, hit the refresh page; you may find your opponent has already moved! Let me find the articles....
https://support.chess.com/customer/en/portal/articles/1444918-my-internet-connection-is-fine---why-am-i-getting-disconnects-
and