Fix DOM layer visibility

This fixes a a couple of bugs in the DOM renderer:

 * Layers where not hidden when `layer.setVisible(false)` was called
 * Layers were removed from the DOM in post render functions, not immediately