The close button can be used to close a window or kill the application, if the application can't understand the close message. The client area is where the application show it's information. If the window if inactive, you can click on it to activate it. Usually it's the window where you work on. Only one window may be focused at a time.
Unfocused windows have a light gray titlebar.
Some applications have a special type of window, called dialog windows transient windows or panels. As soon as the dialog window is closed, the focus is returned to the owner window. The image below shows an active Open File panel and it's owner window. This is the default mode. In this mode, the focused window is chosen based on the position of the mouse pointer.