an ionic bond forms when atoms