Actually, now I know what casues it (but I don't know why it happens). When I remove a USB-stick (or something similar) there appears a little box saying that it's okay to remove it. If I then click the little X in the corner of that box then the taskbar gets stuck (whereas if I let the little box disappear by itself, then the taskbar behaves as normal).