Why is closed queue changing values?