[CI] Fix test: the second test could start with the previous thread not closed

In that case, it could happen that the network port has not been released yet so the second test fails to start a node using the same port.
(cherry picked from commit 62d4bef)
[CI] Fix test: the second test could start with the previous node not closed

In that case, it could happen that the network port has not been released yet so the second test fails to start a node using the same port.
(cherry picked from commit 295a979)