<CLASS DOES NOT EXIST>%Close...
is typical if try to access resultset or just delete rset  after leaving namespace %SYS.
Just reproduced it.

%SYS>w !,rset.%Next(),?5,rset.%Get("Directory"),!?30,rset.%Get("Size"),?40,rset.%Get("MaxSize")
 1    c:\intersystems\iris\mgr\enslib\
                              163       Unbegrenzt
%SYS>ZN "USER" 
USER>k rset
<CLASS DOES NOT EXIST>%CloseCursor+3^%SQL.ClassQueryResultSet.1 *SYS.Database
USER>

#1 there is no "SELECT LAST_SERIAL()" 

#2 depending what your expectation on LAST is I see 2 possible workarounds
#2A LAST = max:    "SELECT MAX(test_id) FROM test
#2B LAST = latest: "SELECT test_id, MAX(ID) FROM test GROUP BY  2"

#2B is based on the fact that you always have an  auto-incremented ID and it's a shortcut of
"SELECT test_id  FROM test where id = (SELECT max(ID) from junior.test)"
or
"SELECT TOP 1 test_id FROM test WHERE ID < 999999999999999999 ORDER BY ID DESC

the second line of the error msg tells you that SQLserver raised error 102

This error occurs when Adaptive Server detects a syntax error in a Transact-SQL® command or query. This error can occur when: A keyword is misspelled. ... You used a variable for a database name and your query contains a parser errorerror 102 is raised because the batch was never executed.
from:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00729.1500/html/errMessageAdvRes/CHDGFCCJ.htm

suggestion: Check the SQL-name of the generated class samples.people