Write the remaning stack content

def write_remaining(self):
        """Write the remaning stack content
        """
        if not self.results:
            return
        with db.execution_context():
            with db.atomic():
                Result.insert_many(self.results).execute()
        del self.results[:]