Fix handling thread interrupt signal