tests: restore wait after exit

On slow systems, the child will not have exited before the next fork.