libfreerdp-core: fix TSG thread shutdown and input freeze problem