test: make threadpool tests valgrind-compliant

Delete the event loop after the test to stop valgrind from complaining
about memory leaks.