Use the system procedure dbo.sa_external_library_unload to unload an external library when the library is not in use.
dbo.sa_external_library_unload takes one optional parameter, a LONG VARCHAR. The parameter specifies the name of the library to unload. If you do not specify a parameter, all external libraries that are not in use are unloaded.
Unload an external function library:
call sa_external_library_unload('library.dll')