Don't save while you have the egg (unless you aren't going for IVs). If you correctly RNGed the PID (controls shininess, nature, ability, and gender) then it doesn't matter when you save. As soon as the egg is generated (as in before you even take it from the old man) it will always hatch shiny...