added 'onreturn' method to connection
added destructors which call mysql_thread_end() before threads will exit