As you use various applications, you are bound to have a rather messy Desktop. Pressing Command-W closes the top most application window, but it can be tedious to close each window one by one. Command-Q quits the application, which might not be the desired behavior.
Pressing Option and clicking the Close button closes all of an application’s open windows, while leaving the application itself still running.
This is really handy if you have multiple IM windows open and want to close them all without exiting the application.