It may be part of the instinctive bedtime ritual, associated with her favored resting spot. Circling several times imbues a place with the dog's scent. Scratching may serve a similar function, physically marking and claiming a spot. Dogs are just as much creatures of habit as we are.