fix detect when client closes connection
fix crash on bluetooth close