Fixing client side thread crash

If the server goes down temporarily or the client just cannot connect
for whatever reason, the client side flushing thread was crashing.
This error is now caught to stop this crash.