That's not what's happening here. The server is closing the socket when there's data from the client that it hasn't read.
If the client does a read() after the RST gets there, any data in the receive window is gone, any packets that might have been dropped and need to be resent are gone, etc.