If it is adding extra code at the end, it sounds like then this table code is not the only code you are using in the post. I can't understand the problem fully unless I know what else is going through the parser. Also what part of your forum are you using the table in?
If it is in a regular (non-wiki) post, then check AdminCP > Wiki Code Manager > Table, and make sure that it's enabled to parse in regular posts.