The Zeigarnik effect describes the way unfinished tasks remain active in our mind, intruding into our thoughts and our sleep until they are dealt with. You may have noticed the effect yourself during your exams in school, when you crammed before the exam, sat it, and then promptly forgot everything you had just learned because you no longer had any use for the information.
https://scitechdaily.com/boost-your-productivity-with-the-zeigarnik-effect/