If you are looking to improve, you need to answer a number of questions:
1) Is this Blitz (or bullet)? If so, these games mean total zilch!
2) Do you play over the board tournaments? If not, and you really want to improve, you must make this adjustment!
3) Do you study any books? Especially those on Tactics, Strategy, and Endgames? If not, this is a major adjustment that must be made. 1 Hour of studying a book at a 3D Chess Board (forget e-books, or anything that allows you to click quickly - known as passive studying - you need to be serious about what you are doing) is more effective than 12 hours of internet blitz.
4) While I have not specifically analyzed either position in depth, were you ever better except maybe near the very very end in the second game. I almost think Black was better for a large portion of it.
5) Do you understand defense, or do you just look at what you have, and not take into account threats. You seemed to fail miserably in the first one. Allowing f6 by White was a major problem, and then you allowed it to escalate from there. Qg5 is complete death!
I play well in the opening and middlegame.. get the advantage and then lose it during the endgame or pre-endgame. How to resolve this issue?
Please help.