There seems to always be that one moment when your computer inevitably freezes. You cannot click on any windows or close any tabs.
Before we can ask the question, "Why did this happen?" we have to get rid of that pesky window that will not close. So, what is the easiest way to do this? It's called Force Quit.
To Force Quit an application, you can go to the Apple Menu () in the top left of your screen, and navigate to Force Quit in the dropdown menu. If you are comfortable with keyboard shortcuts, you can access it slightly quicker by pressing the Command(⌘) + Option + Escape keys. This shortcut is also handy if your computer is completely frozen, and you are unable to click anywhere on your screen. You simply then click on the application that is giving you problems (it may also say "Not Responding" next to the problematic application), and either press Force Quit or hit <Enter> on your keyboard.
After you close the window, you may ask why this happened. There are many, many reasons why it could, but probably one of the most common resolutions, and this is no joke, is restart your computer. I had an old co-worker whose email signature said, "Did you turn it off and turn it back on again?" It may seem simple and trivial to try something like that, but let me put it in a metaphor. If I, Stuart, were to stay awake for 48 hours straight, there is a good chance that I would start saying something I wouldn't normally say, doing things I might not normally do, etc, etc. The same goes for your computer, iPhone, and iPad. Make sure you regularly power it off (I try to make sure I restart my phone at least once a week). Your devices will thank you.