Well it's evident you got hardware troubles, but as to what it is I'm not entirely sure. The only thing I can see that could explain the laptop turning itself off as opposed to restarting is a power, motherboard of cpu issue, either of which are typically irreplaceable in a laptop chassis (the cpu probably is).
It may be the oddball case of overheating, though I doubt it given that memtest hardly uses the cpu. Still, it's free to open the thing and determine if there's a bunch of dust cluttered inside.
In any case, it just sounds like the ole laptop is about to meet the trash bin. You can try coughing up some dough to purchase some replacement memory, since that's your cheapest and only available option right now (aside from the cleaning). However, while the memtest problem suspects potential memory issues, the system turning off completely does not.