Java class for closing Window