private void StopImpl(Action action)
{
Log.Info("Program stopping......");
ExecutingThread.Abort();
IsRunning = false;
//We need to wait here until all download threads are fully killed.
foreach (var thread in DownloadThreads)
thread.Join(); //wait for all workers to stop
if (action != null)
action();
}