When magnesium is burned with hydrochloric acid, a pop sound is heard when a glowing splint is brought near the beaker. It is because: