Fix thread and process termination on exit

- Remove extra glue layer
- Don't call null function pointers on exit