XWIKI-10349: Memory leak in Velocity namespace cache

(cherry picked from commit 000e59f1c02d933cdf67e06f8c43e57bae482958)