reordered closing of connections in tweethandler.