How can I create a smooth looping animation for cloth simulation? I have created a waving flag simulation by pinning a set of points, adding cloth physics, and setting up wind forcefields. The result is just fine when I render the scene except that I want the resulting png files to be a continuously looping animation. 
The resulting animation is currently jumping when the loop transitions from the last frame to the first frame.

I have tried exporting to lightwave format, importing it back in and inserting appropriate shapekeys to get an interpolation between the last and first frame, (as described here), but it seems the export-import step messes up both the orientation and the basis for the shape keys.
I tried exporting-importing twice
and I also tried using a custom plug-in that fixes the orientation issue, 
but my shape keys at 1.0 value are always stretched out and rotated compared to the same shape key at 0.0. 
The result is that after interpolation, the flag not only waves, but also rotates and stretches.

I am thinking about trying one of the following routes:


Somehow edit the necessary shapekeys at value 1.0 so that it matches the orientation and rotation at 0.0. 
Look into the export-orientation problem and see if I can fix it myself.
Try to morph from last frame to first frame of the rendered result using some other tool.


What do you think is the easiest and best way to go to get a nice loop transition?

Edit:

After trying sambler's suggestion using two modifiers with varying influence in the transition between last and first frame, the mesh seems to be rotated and scaled in the frames where the modifier influence is interpolated.
My first choice would be to run the simulation for the entire animation, but the idea of using the MDD exporter could be applied a bit differently than the example you gave.

Export the cloth simulation to an mdd file.

Remove the cloth simulation from the object and add a Mesh Cache modifier. Set the File path to the mdd file you saved previously.



This will play the cloth simulation using the exported data. By using keyframes on the modifier values we can make it repeat the same simulation data. By using two mesh cache modifiers we can have a chance to smoothly transition between repeats.

Lets say we have a cloth simulation of 100 frames.

We have modifier1 with a frame start of 1 and then keyframe the influence to go from 1.0 on frame 95 to 0.0 at frame 100.

Then we have modifier2 with a frame start of 95 and influence keyframed to go from 0.0 on frame 95 to 1.0 on frame 100.

This should give us a smooth transition between the last and first simulation frames.

By keyframing the start frame we can re-use the two modifiers to repeat the simulation over and over again.