[WIP] Fix hang on exit