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.
Maybe I'm missing something... what's bad about using ``get_current_request()`` here? I'll admit I'm not fond of the function (but then again, I'm not fond of program modules in general), but given that we already use it a bunch inside program modules, I don't see the harm in using it here in particular.