added statements to shutdown threads