Change in photospheric magnetic flux during coronal mass ejections