fix closing handshake (again :)) and test