Far from an expert…
It’s got to be something to do with the hinge. The mechanism should allow the top of the opening it to tuck into the top part of the frame. Something isn’t pivoting correctly which means the top of the opening bit isn’t sitting where it should.
Guessing you’ve got a hinge like this?
There’s either play in one of the pivots (2,3,4,5,6) or something has seized. I’m guessing if you’ve forced it shut, you might also have something bent.
Try opening the window all the way and pulling the top part down towards you as you close the window (mind your fingers!). If something has seized, this might at least loosen it up or realign any play in the hinge.
My old house had a couple of widows that wouldn’t close properly at the hinge side. I used to have to grab the opening part of the window and yank it pretty had to get the thing to close evenly. Pulling the hinge side into the frame as I closed it.