Diagnosis
The latch mechanism inside the handle has worn out or broken. It's a common wear point from the constant open/close action.
How to Fix It
First, check for obvious obstructions. Open the handle and look for a stray piece of a K-cup foil lid or coffee grounds jammed in the latch hook. Clean it out. If it's clear, the fix is usually replacing the entire brew head assembly (the handle and the part it attaches to). You can find the part online. Replacement involves a few screws on the back of the machine.
If That Didn't Work
Sometimes, the metal hinge pins just work loose. With the machine unplugged, see if you can gently push the hinge pins back into place with a small punch or the end of a paperclip. Don't force it.
Heads Up
A loose handle means it's not creating a good seal during brewing. This will lead to leaks, poor pressure, and weak coffee. It's best to fix it before it fails completely mid-brew.