flag socket as closed when writes fail