When can I leave a match and still have it count for stats and merits?
I just did some testing, and yes, you will receive merits after leaving the match as long as the win/loss has been decided.
Keep in mind that when you leave the match early, you will also be removed from your party if you have one.