A few suggestions...check your grip when shooting...it is entirely possible that you are pushing down on the slide catch with one or another of your thumbs...it does not take much pressure at all to prevent it from engaging. Remember, too, that just because you don't think you are doing this, is no proof that you are NOT doing it under recoil with live ammo. Maybe get someone to watch your hands when you shoot.
Try the gun with an empty mag and see if it will lock the slide back whan you manually pull it to the rear "smartly"...pretty hard. If so, check your grip again. If not, it could be that you have taken the mags apart for cleaning and reassembled them with the spring facing backwards, which will cause this, or less likely, that your mag springs need replacing.
Two other things that might cause this...an extremely dirty / unlubricated gun with lighter-loaded ammo such as standard WW "white box" ala WalMart, and / or a very limp hold with the last shot...but these do not sound like quite the problem you were having.