Updating the examples for addOnUnload and addWindowUnload to AMD syntax.

Clarified the example for addUnload. Converted addWindowUnload example to AMD syntax. Refs #17468