ControlData now TerminationProc

Updated ControlData to be TerminationProc to allow for more versatile
behavior when hooking in with asynchronous programs.
Also fixed a memory leak in thread termination.