Changed LayerVisible(), to use layer.SetPersistentVisibility(False).

Without this line layers that have been switched off with LayerVisible(l,
visible=False), behave strangely when they have parent layers. If the
parent layer is switched on and the child layer is switched off via the
function, it will not be fully off as in pushing the light bulb in the
layer editor UI. The child layer is in the state that it would have, when the parent
layer would be switched of (the half light bulb). This behavior is in
contrast to the behavior achieved with the UI. Furthermore, when a child
layer is in theis weird hidden state and any layer is switched to locked
with the button in the layer manager, the hidden child layer switches back
on.