Does the slide not stay open on one mag or on all mags ? If it does not stay open on multiple mags then it is more than likely an issue with the slide stop. What make and model of pistol is it ? The slide stop tab that is engaged by the follower in the mag could be worn or defective where the mag follower is not pushing it into the corresponding notch on the slide. If you are dealing with the problem on one mag then you may be able to slightly bend the section of the follower that pushes the slide stop. If a plastic follower then it needs to be replaced.
Some semi-auto pistols were not designed to hold the slide back after the last round fired, so it is important for you to list the make/model of pistol at issue, as well as the mags being used.