Your brain has to let go of all active threads of thought to successfully go to sleep.
Active threads of thought tether you to the waking world.
If you're trying to keep track of a thing in your working memory (because it's not stored in some external system), that's a thread that will tether you to the waking world.