The stress of being chased around and shoved into a small container caused her to give birth prematurely and the embryos haven't finished developing yet. In short, you stuffed up.
Never move the females if they are gravid (pregnant) unless you absolutely have to. If you have to move them, carefully catch them in a net. Then put a container in the tank and scoop the female up in some water, while she is in the net. Then move her in the container to a new tank.
Never put them in a small container because it stresses them.
Never lift them out of the water if they are heavily pregnant because the pressure on their body can kill the developing embryos or cause a premature birth.
The best thing to do for female livebearers is have a well planted tank and remove the males. Then the females can give birth in peace and things like this don't happen.
---------------
If you let the female swim out of the trap, the eggs might continue to develop in the trap.
Make sure the males don't harass the female. If they do, move the males out.