Sugar cookies should be completely cool before you frost them. If they aren't, the frosting will not be smooth because the cookie will shift and tighten as it cools. The frosting will also run off a warm cookie! Allow the cookies to cool for at least 2 hours. But they should be totally cooled before frosting.