electrons don't just fly off into space because charged particles attract each other, keep in mind that alike particles repel off each other.
electromagnetic forces hold the electrons in orbit around the nucleus in the center of the atom. As they move in a repetive motion, they stay close together to stay in line.
Hope this helps!!