There can be up to 3 threads participating to the close client connection.
On the server side, if an event enters (such as a read event because client responded to the close message) it will be expected that the reads are not closed by the upper layers. In case the reads are closed, the "mouse hole" to complete the connection close closes
Changing to have read followed by write on the client side, and the opposite on the server side. will prevent the client side from closing and the server side from being stuck.
Reproducer of the issue: