Terminate the Agent

Terminate the agent right before the application exits:

appd.TerminateSDK()