Your UAM's UAMCall routine is called with a command of UAMClose to close the UAM. Your UAM should deallocate any memory that it has allocated and unload any shared libraries that it may have loaded.