fix scope of layer variable, remove unneeded visibility temporary storag...

...e (was used in case of layer not visible

followup on https://github.com/camptocamp/cgxp/pull/623