wait command to finish