waiting for cmd exit