While it's not possible to diagnose problems with specific guns over the internet, there are some common conditions that can cause the slide of a typical 3rd gen pistol not to remain locked open when the magazine runs dry.
A damaged follower could be involved. (The yellow followers are older ones and the light blue followers are the current ones, BTW.) What are the chances all 3 of yours could be damaged? Dunno. Not there to look at them.
Damaged or worn magazine springs can cause this to occur, too, and it's often more likely to be involved if the springs haven't been replaced for a while. Typically it's recommended that S&W armorers replace mag (and recoil) spring either every 5,000 rounds or every 5 years in dedicated service pistols, whichever comes first. When was the last time you replaced the springs in your magazines? How old are the springs?
Dirty magazines can impede the normal movement of the followers. (Add some dirty magazine bodies to any potential for weakening springs for a double whammy.)
A damaged slide stop. It's an assembly, containing a spring, plunger & roll pin. The body itself could be damaged or something could have happened to the spring & plunger. (I've seen 1911 slide stop levers have the inner tab break off, but I haven't seen it happen in a S&W pistol ... yet.

) Also, there's been some revisions to the plunger & spring in the 4006/3 slide stop levers over the years.
A damaged side plate. This is the thin metal plate which runs along under the top of the left grip, and which forms the small angled plate against which the slide stop lever plunger presses. The angle of the plate, its stability and the strength of the lever's plunger against it work to control the lever's normal functioning. It's not uncommon for someone to remove & replace the grips improperly and tweak, spread or even break off the side plate's legs which snap over the left end of the sear pin. If the side plate isn't held still (a function of the fit of the legs around the sear pin) problems with the lever's functioning could occur.
If you can gently move the small angled side plate up & down at the front where it engages the slide stop lever, you may need a new side plate installed.
If the little plate seems solidly held in place, and the lever's plunger has freedom of movement in & out of the lever body, some new mag springs (and followers), combined with clean mag bodies (dry inside) would probably be the easiest attempted correction.
Have you owned and used this 4006 for a while?
The reason I ask is that another instructor brought me a new 4006TSW out on the firing line and said there was a problem with the lever because it wouldn't lock the slide back on an empty mag. I gave it a brief check and didn't see anything obviously amiss. I asked who was shooting it. The shooter was nearby so I called him over and asked him to shoot the gun while I watched. He was right handed, and I noticed that he used a grip technique which allowed his left (support) thumb to tighten at the moment of recoil and press exactly down onto the lever (preventing it from rising). When he shot it left-handed the 'problem' instantly disappeared. I spent a few minutes resolving the shooter problem instead of fixing a gun problem.
Like I said, I can't pretend to know what's happening with your 4006 without being there to look at it and shoot it. (Maybe not even then, since I'm just an armorer and not a factory gunsmith.

) I'm just offering these comments because they're typically the probable causes of what you're experiencing and give an experienced armorer a place to start looking.
Got a gunsmith familiar with S&W 3rd gen pistols nearby?