Fixed race condition with shutdown flag