Guard against race condition on threads keepalive

Requests after the first on a keepalive connection remove themselves
from the keepalive timeout queue. This presents a race condition where
the main thread might try to access the first element of the queue
after it has been removed.