How can I add close(X) button to the window like this screen?

Now I have the following window:

How can I add close(X) button to the window like this screen?

Now I have the following window:

You will need to manually define a toggle button in the corner of your window, which sets a variable that will set whether to display the window in question. Something like this:
bool showWindow = true;
if(showWindow)
{
GUI.Window(whatever options)
}
Then inside your Window function, have a button like this-
showWindow = !GUI.Button(wherever you put it, "X");
This will make the window disappear when the button gets pressed.
Of course, you will need to set showWindow back to true if you want to display the window again!