Check for shutdown before attempting to run task