I see this issue on both refrigerators with ice makers and undercounter ice machines where there is some type of filtration system or water softener added to the home supply. Air will get into the lines. If you run your faucets until the air is removed, you still won’t remove the air that is in the tubing to the ice maker itself. It can take several days before that air is removed.
You can manually cycle the ice maker if you know how too do this. The owners manual might have that information. You could try to run a clean cycle on the ice machine. That usually takes care of the problem.
I don’t know if anyway to prevent it. When you remove a filter, air will get in the lines. Removing that air is just a matter of flushing it out, replacing the air with water.