Properly close ws when logout