Close window before selecting a different view