waits for processes to finish instead of kill