Close EditorWindow in Play Mode

I’m having issues where an Editor script behaves strangely when the user enters play mode. How can we close an EditorWindow when the user enters play mode? If possible, how can we open it up again when the user exits play mode?

This is actually a very simple process. You can check EditorApplication.isPlaying in an update function. If the user enters Play Mode, open another temporary window and close the current window. You would do the same in the temporary window, in that when the user exits play mode, then open the previous window and close the current window.