Yes, you can. Keeping a window shut or open doesn’t matter in case of air purifying. An air purifier can filter all the air passing through it seamlessly into the room.
If you keep the windows and doors closed where a purifier placed, it will enhance the air purification process with such effectiveness from external germs or pollutants.