Use Logoff command, 1 will force the user to quit all applications.

code:
LogOff(1)