close() works correctly depending on client vs server
handle errors during connection upgrade