clear caches just before python shutdown: avoid segfault and "corrupted double-linked list" message