Common causes
The latch is broken or loose.
Worn hinges make the sash drop out of line.
Deformed gaskets or a warped sash.
Fixes
Replacing the latch or adjusting or replacing the hinges usually solves it. If the sash or frame is badly warped, consider replacing the window. Until it is fixed, take extra care in typhoons.
Official sources
This page is general guidance, not legal advice. If rules change, the government department's information prevails.