Add timeout for close stream operation.