fixing error where bot doesnt shutdown properly