fix closed and retry logic