Fix race condition in AgentListener::NewClientHandler.

Refs #4865