wait for the end of the process