missing "end"

message: 'end' expected (to close 'function' at line 885) near '<eof>'