Trigger Client Shutdown

How would one go about triggering a client shutdown from within a client module?
:scratch:

Also is it possible to intercept a logout request from within a module?