check if XInitThreads fails
minor cleanup of exit

doesn't work on linux