Fix sendAfterClose

On send mark connection as closed in case if it's impossible to
close it immediatelly and close if as soon as it will be possible.