Closes the log file when unloading the dll.
SCardEstablishContext must be called in each instance, otherwise a token change will cause no more access to the token.