Stretch it as far as you can, take some time off before you call it quits. Worse comes to worst, at least you'll have a place to return to. Second, when looking for work it looks spectacularly better if you're currently employed and looking to leave the place.