threads now stop after closing the window or hitting ESC