The app is more robust resetting the socket in the close hdlr

This is mainly to account for UNDERTOW-353