tests: Fix stopping valgrind in tests

Processes running using valgrind may need a lot of time to terminate
after receiving SIGTERM. In most cases it's more than 10 seconds. This
commit fixes terminating processes in tests to be able to check for
memory leaks in such cases.

Change-Id: I59d504d292c072fa9b088aa7fb9c7c78c30f26f9