Add generic thanks page for when a mainpage is closed

Sometimes it is useful to have a program module deadline open even if the
corresponding /MainPage deadline is closed.  However, many program modules
redirect to the main page on completion, which causes the user to get confused
if that page is in fact a deadline error.  Now modules can optionally have the
redirect be changed to a generic thanks page if the core module is closed.  I
added this to the teacher events module, which is the one MIT wanted it for.

This is a bit hacky, so suggestions of better ways to do it are welcome.  Or we may just not want it in main.
It's nonlocal and should never be necessary.  I believe in having obvious control flow whereever possible; it makes reasoning about code and testing easier.  But in any case, if you don't think it's bad, I can leave it here :-) .