When I close the circuit, the lock opens, but when I open the circuit, most of time it stays in in the same position and I need to tap the lock slightly. I think there's a small magnetic field yet inside and the spring is not powerful enough to release the lock.
I had one of these (cheap model from the Far East) and the issue was mechanical, the moving piece was getting stuck because it was not pulled-in straight
I poured a bit of silicon based oil into the moving pieces and then it was working fine
Tap it in with a hammer, because that's what a magnetic field will do. A finger push is delivering the push with 1/4" of soft, mushy goo as a buffer. If it still doesn't jam, look for other solutions, but I'm still betting on mech interference/fit in some way.
The concept of discharging an inductor is a misnomer. It will discharge itself very quickly. Do you have a revere bias diode across it to cut down on the interference?
Reverse voltage will do nothing. Because it is an electromagnet and that pulls in just the same.
The possible causes are
residual magnesium in the plunger holding it in, because of a poor choice of material used for the plunger. You might try an AC voltageq to stop it happening.
I looked at your demonstration of residual magnetism. As already mentioned, a good demonstration of the use of wrong material in your latch. AC may or may not fix it. All depends on what part of the AC cycle the circuit is opened. If opened when the current is max and the magnetism is max, then you have the same problem as now.
Try a drop of light machine oil on the plunger. Don't use WD-40, it doesn't leave any residue.
Examine the plunger closely for a wear mark that could indicate a burr on the frame stamping. An emery board or small metal file can clear the burr.
My concern was whether your circuitry was completely cutting the current off, or whether a small current was still being allowed to flow. It takes much less current to hold a solenoid in that it does to pull it in.