You can't end a game or a half on a defensive penalty, because otherwise, teams could commit infractions with no fear of any punishment. But that's not the case at the end of a quarter, when play continues as is after a short break.