Ionization state and magnetic topology of coronal mass ejections