fix for dlclose refcount cleanup

Converted the refcount decrement to a prefix operation so the shared library is cleaned up properly.