When the application exits add functionality to wait for tasks to finish
When the application exits add functionality to wait for tasks to finish