Run the 'temporary set layer visibility property to false ...' only on
set visibility to true.

Move the delayed setVisibility true in the WMS layer to be delayed in
all case.