In a given Mathematica session all variables that you set are remembered throughout the session unless you explicitly clear them or unless they were localized using, for example,
Block. If you quit Mathematica and then reopen the notebook the variables are not remembered from the previous session (except in the special cases where they were saved in certain user interface constructs--a more advance issue though which you will not encounter until later in your process of learning Mathematica).
So if you execute
then any time later in the Mathematica session where you use x, it will have the value 5.
If though, the Mathematica Kernel crashes for some reason (shouldn't happen, but it sometimes does), then you will be effectively be starting a new Mathematica session and the value of x will not be known in the new session unless you set it to 5 once again.
So this leads me to believe that what you are describing is something other than how it reads. Could you give a simple example of what you are describing?