When a program stops responding, and turns gray and the box that says "this program is no longer responding" comes up, How do I know when to close the window, and when do I wait for it to respond?
There isn't one answer fits all... this really comes down to your individual experience and the program involved.
Typically, a program will have this when it fails to respond to typical Windows GUI commands/events such as maximize/move e.t.c.
Typical reasons for this is that the program is single threaded and is currently busy processing a command (for example, saving).
Usually a program will come back to life upon it completing the task, but, there is just no way to know in advance - as much as it could be completing a very complex task, it can equally be likely that it is also in an infinite loop and will never recover!
Personally, I would say that if it is freezing in reaction to something I have done, I would wait (up to) at least a minute (e.g. click saving), but, if it is just random, and it isn't some intensive tasks I would say either give it a minute or conclude it is frozen.
Sorry I can not be more precise, but, there just isn't a single answer that fits everything.