It is all about controlling emotions and having strong will to just stand up and do something else for the day. Sadly it's in our human nature that we we want to recoup our losses and that makes it so damn hard to stop, which makes us play with emotion instead of our brain, resulting in even more losses.
I believe that with experience your skin gets a bit harder and it's easier to control emotions, but some days it just gets to us (look at pros like Phil Hellmuth exploding when being beat). So there really ain't no golden rule on what to do.
Personally when I'm having a bad day with bad beats left and right I just close the tables, play 1-2 0,25cent spin and goes and call it a day. If I win those spins I'm happy and tell myself "at least I won something", if I lose I just confirm it's a shitty day and try to move on from it.