wait for ctx to close