improved visibility option for layers and added close window function