Threading fix for CTRL+C