This is about "focus"... which window is at the top of the keyboard and mouse stack and will receive input.
If you mouse up and get the taskbar to pop open then click on it (the bar itself, not an icon)... it will never close... because the mouse focus is now set to the taskbar. To get it to close, you simply click on the open area of your desktop... or launch a program... as soon as focus is shifted away from the taskbar it will hide.
The apparent lockups come from some applications not resetting keyboard focus to the foreground window or desktop when exiting. Simply clicking on something else should close it.
The other big cause is notifications... Those little ballons that pop up from the taskbar... the #$%@$ action center drove me nuts until I disabled it.