XWIKI-10349: Memory leak in Velocity namespace cache

(cherry picked from commit 762d36f6624d7f346117932e46ad056e2a80523c)