Or you can create a thread.
ThreadProc has for() loop - let it do the job than put it to sleep (for 5 sec)
You can also implement TerminateFilter to close it gracefully
The good thing about it – if you need COM access you can CoInitializeEx only once ;-)