I have only seen this happening if a user does not have correct permissions on either the config directory or the user directory (read rights because you do need to find out what config you have) Make sure to set permissions correctly.
As Ray_handels already alluded to, this is probably due to another configuration issue, rather than that logoff script.
By default, UEM will automatically perform a logoff in case the Flex config files path is not available at logon. You can override this behavior by configuring the Paths Unavailable at Logon policy setting. Once you've done that, it should be a bit easier to find the culprit.