Backport #14006 After cancelling the context we still need to wait for the command to finish otherwise zombie processes may occur Fix #13987