Match the BeginFrame with an EndFrame.

Match the BeginFrame with an EndFrame to avoid leaking memory and asserting.

I hand't run in a build with asserts so hadn't noticed this before.