Close the Marquise context, ensuring data is flushed and
        spool files are closed.

        This should always be closed explicitly, as there's no
        guarantees that it will happen when the instance is deleted.

def close(self):
        """Close the Marquise context, ensuring data is flushed and
        spool files are closed.

        This should always be closed explicitly, as there's no
        guarantees that it will happen when the instance is deleted.
        """
        if self.marquise_ctx is None:
            self.__debug("Marquise handle is already closed, will do nothing.")
            # Multiple close() calls are okay.
            return

        self.__debug("Shutting down Marquise handle spooling to %s and %s" % (self.spool_path_points, self.spool_path_contents))

        # At the time of writing this always succeeds (returns 0).
        MARQUISE_SHUTDOWN(self.marquise_ctx)

        # Signal that our context is no longer valid.
        self.marquise_ctx = None