Command + W on Mac (or Control + W on PC) is the default shortcut to close windows, tabs, etc in most applications. So, when you have a composition selected in After Effects and use the CMD + W shortcut it will close that window.