If you're spawning threads, and saving the references on the t Array, you should be sure all the threads are killed. You can check the Msf::Auxiliary::Scanner mixin or the modules/auxiliary/scanner/portscan/tcp.rb for examples of how to deal with threads.