fixed dll handle being released correctly