|Where is %user% being set? If %user% is undefined it will cause the if statement to be invalid, the same will happen if it contains certain characters, mainly |,<,> and &. To avoid this enclose it in double quotes.|
if /i "%user%"=="x" set user=o & goto :start
This will cause a similar problem if the strings contains double quotes, but there is a work around for this if needed, using dynamic variables that escape the meaning of the double quotes.
A good way to troubleshoot scripts that close unexpectedly is to run them from the command prompt with echo on so you can see the error that is returned and where the script stops.