Chicago 17 - Excessive comma when no pages cited

I am using a slightly customized Chicago 17 Footnote style. My output style formatting for a book looks like this:

Author, Title| [Translated Title]|, vol.·Volume|, ed.·Series Editor|, trans.·Translator|, Edition.·ed.|, Number of Volumes·vols.|, ed.·Editor|, Series Title|, vol.·Series Volume| (|Place Published|: Publisher|, Date, Year|; repr.,·Reprint Edition|)| Type of Work|. URL|,·Cited Pages|

This formatting is intended to add a comma after the closing parentheses if cited pages are present, and to omit the comma if there are no cited pages. However, the output I get is incorrect when pages are not present.

Using {Eisenstadt, 2003 #1544 12-13} should produce:

Shmuel N. Eisenstadt, ed., Comparative Civilizations and Multiple Modernities: A Collection of Essays (Leiden et al.: Brill, 2003), 12-13.

And it does.

Using {Eisenstadt, 2003 #1544} should produce:

Shmuel N. Eisenstadt, ed., Comparative Civilizations and Multiple Modernities: A Collection of Essays (Leiden et al.: Brill, 2003).

Instead, it produces:

Shmuel N. Eisenstadt, ed., Comparative Civilizations and Multiple Modernities: A Collection of Essays (Leiden et al.: Brill, 2003),.

In other words, a comma appears after the parentheses even when no cited pages are given.

How do I fix this?