Let's analyze the positive's of the ending......( Spoilers)
We all know that Gary is ultimately heartbroken at the end but let's see what he has learned....
1. Rick and Karen are a match made in heaven. Rick will continue to treat her like crap and cheat on her and she won't care. I am sure that he will get her pregnant again but this time ( hopefully ) Gary won't come to her rescue.
2. Gary now knows a little of what goes on in the real world. He knows what kind of friend Rick is and what kind of girl Karen is.
3. Hopefully Gary will come to realize that Rose feels the same way about him that he felt about Karen.
4. Right when Gary thought that Karen and himself were an item, she stabbed him in the heart. Well much better sooner or later. It would be inevitable that it would happen, so for Gary's sake it is better now then later.
Gary probably learned a lot more then a typical 17 year old. Hopefully he is smart enough to learn and move on. It would have been nice to see a ( 6 months later ) and see Gary with Rose.