pkcs11: Refactored session state variable to getSessionState() function