Fix two problems with merging pass-through layers
- Fix a crash when trying to merge two groups with pass-through (we shouldn't start a image()->refreshGraphAsync(merged) before the layer is added to the tree)
- Fix flattening and merging of pass-trough layers with usual layers. Basically, we should switch-off pass-through mode right before merging.