copy keys in client sockets during error handling to keep python from complaining about the dictionary changing size