Window managers usually provide a graceful way to exit from your X session. Many times this takes the form of "logout" or "exit session" menu choices.
Always shut down properly!
Anytime you want to stop your X11 session or shut down Linux, use the proper keystrokes or commands. Never, never simply turn off your computer. This can wreak havoc with the file structure of your Linux partition!
You can also immediately exit from your X session by pressing Ctrl+Alt+backspace. Exiting through your window manager is preferable, however, because it gives the window manager the opportunity to save user preferences and exit any running programs gracefully.