Add expiration to threads, close a thread if expired