What is mentioned in a couple of these comments about your body's response to external stressors changing how it allocates calories is absolutely true, but it's at the margins. If you're at maintenance caloric intake and ± a couple hundred calories a day, over years this can have an effect. But it's not going to meaningfully impact a 500-1000 calorie/day deficit to the point where you're still gaining weight.