This commit fixes potential bug of GTM proxy to handle disconnect.

Andcrei Martsinchyk reported the bug and provided the fix.