Prevent crash in client shutdown