Continuity mistake: When Andy locks himself in the jail cell, the key is lying flat on the short wall, but after Barney locks himself in the other cell, the key has turned itself upright on its side.
Other mistake: After Barney gets annoyed over Andy's lack of confidence in his ability to be a sheriff, Barney gets on the phone with Sarah and asks to be connected to the mayor of Greendale, then it cuts to an exterior shot and the parked car has plate number "DC 269," the same as other vehicles in some earlier episodes.
Answer: Those "boxes" are valences that used to be very common, before air conditioning. They allow for windows to be open during rain storms. They permit air circulation, without letting the rain in.