I think my mind does this sometimes as well. I'm not sure but I think its when your subconscious starts to prepare for you to dream.