D1246: DC Destroyed While Drawing

A device context was destroyed while inside a BeginDraw/EndDraw block.