Fix for crash on exit on Linux.