Cleans up this result so that all its pointers reference memory controlled
        *outside* of the shared library loaded with ctypes.

def cleanup(self):
        """Cleans up this result so that all its pointers reference memory controlled
        *outside* of the shared library loaded with ctypes.
        """
        #First we *copy* the arrays that we currently have pointers to. This is not
        #the optimal solution; however, because of limitations in ctypes, we don't
        #know anything better at the moment.
        for key in self.result:
            self.result[key] = self.result[key].copy()

        #Now deallocate the pointers managed by Fortran in the shared library so that
        #any subsequent calls to the executable that generated this result creates
        #new instances in memory.
        for key in list(self._finalizers.keys()):
            self._finalizers[key].clean()