Fixes unexpected connection close