Ensure visibility flags persist across commit

When a ghost unit is committed, the actual unit is deleted and then the new, real unit is added based on data from juju-core. We need to copy the visibility flags down from the service during that process.
While debugging this issue, I noticed uncaught JS exceptions because we'd add "undefined" to the list of changedMachines. It didn't cause any bugs because it resulted in a no-op, which is what we want to happen anyhow, but still…