Memory leak in extension functions and utils

The use of ThreadLocal and static fields prevent XProcRuntime (and its references) from being gc'd. This patch removes those references, while maintaining the current API.