ie, check if stream/socket is closing/destroyed etc in the apis and return an error
ie, check if stream/socket is closing/destroyed etc in the apis and return an error