tests: improve the robustness of process cleanup on INT/TERM signals