channels/smartcard: cleanup context/handle management
channels/smartcard: fix on Windows