fix for refcount cleanup
Merge pull request #1414 from inolen/dlclose_refcount_fix

fix for dlclose refcount cleanup