Modified the way to stop clicks closing the window