Fixed an incorrect reference to pkg_path

The variable pkg_path was not available in the closure.