Improve some shutdown problems

@thedax I'm not sure which issues you were seeing before, so I'd like to know if these changes cover them or not.

Changes:
 * glDisableVertexAttribArray on shutdown (fixes crashes in UI / GL.)
 * Switch the run loop on Windows to care more about globalUIState.
 * Don't keep on truckin' in EmuScreen when CORE_POWERDOWN is hit, avoiding crashes.
 * Avoid another 32-bit cond var issue with multithreading (happened during shutdown sometimes.)

-[Unknown]