code: func (p *PAM) Close() error {
  	// Close the PAM session. Closing a session can entail anything from
  	// unmounting a home directory and updating auth.log.
  	p.retval = C._pam_close_session(pamHandle, p.pamh, 0)
  	if p.retval != C.PAM_SUCCESS {
  		return p.codeToError(p.retval)
  	}
  
  	// Terminate the PAM transaction.
  	retval := C._pam_end(pamHandle, p.pamh, p.retval)
  	if retval != C.PAM_SUCCESS {
  		return p.codeToError(retval)
  	}
  
  	// Unregister handler index at the package level.
  	unregisterHandler(p.handlerIndex)
  
  	// Release the memory allocated for the conversation function.
  	C.free(unsafe.Pointer(p.conv))
  
  	// Release strings that were allocated when opening the PAM context.
  	C.free(unsafe.Pointer(p.service_name))
  	C.free(unsafe.Pointer(p.user))
  
  	return nil
  }
docs: // Close will close the session, the PAM context, and release any allocated
  // memory.