XWIKI-10349: Memory leak in Velocity namespace cache

(cherry picked from commit c1affae1a2c14681779594d9c01999b1f35dc4cf)