It does both.
If a player leaves before the match starts, or just after it starts, the game ends automatically, no one wins or loses.
If enough players leave during a match (one isn’t enough), then you get a message saying you can leave without penalty and you’re free to do that.