Prevent memory leak.

The frame_filer callback closes over $self, which creates a memory
leak.  This fixes that problem by weakening $self.  Also added
an xt test case to verify.  If you don't weaken $self, the test
will show the memory leak.