If there is pending data to be sent when the socket is closed, it will continue to be sent after the socket is closed until either it is all sent or an error occurs. Both writing and closing are asynchronous in TCP.
This is not peculiar to NIO or even Java.