[minor] Wrap library code in a closure