Improved failsafe close handling for half closed endpoints

(cherry picked from commit 61b2e7f75ea7398e33452b78af4282091fe7b26b)
4 files changed