handle remote end connection shutdown on receive

Signed-off-by: Roman Yeryomin <roman@advem.lv>