[ASIO] Fixed a race on engine shutdown.

During engine shutdown, there was a race condition where context iterates through all the sessions
and detaches them while the engine's thread is receiving EOFs from remote nodes disconnecting from
this node because the synchronization streams were closed. That lead to a situation where the dtor
from the main thread could call detach() for a session which was just destroyed by the engine one.