You should have the windows shut with a dehumidifier. Opening windows might encourage moisture from the outside, which makes the dehumidifier’s task more challenging.
Keeping them shut, allows the air to be conditioned more rapidly, making the dehumidifier more efficient.