Crash fix on client close