Handle client disconnect more properly