Hello Bjarne,
Which version and build of SQL Anywhere 12 are you using? There was a bug (CR #739187, fixed in 12.0.1.3902) where if you issued 'STOP EXTERNAL ENVIRONMENT CLR' that even if no other connections were using the environment, the external executable (dbextclr12.exe) would remain running - it's this executable that will actually be holding a lock on the assembly file.
You can try upgrading to 12.0.1.3902 or higher (In the SAP Service Marketplace portal: Support Packages and Patches - S > "SYBASE SQL ANYWHERE" > SYBASE SQL ANYWHERE 12.0 > SYBASE SQL ANYWHERE 12.0 (Support Packages and Patches) > Windows on x64 64bit > "EBF 22109: 12.0.1 SP66 Build 3994 - 64 Bit", or download the EBF from downloads.sybase.com), try the "STOP EXTERNAL ENVIRONMENT CLR" call, and see that once the executable is shut down, if that releases the assembly file lock.
Regards,
Jeff Albion
SAP Active Global Support