Forced separations behavior

Please help! Trying to get short form citations to work…

The following command works fine: whenever the “cited pages” field is empty, the “Year” will be followed immediately by the final closing bracket

(Author|, Year|, Cited Pages|)

However , the following does not work the same way:

Author|, Year|, Cited Pages|.

All I have done is remove the ( ) and use a full stop at the end. Yet now, when the “cited pages” field is empty, the comma appears before the final punctuation!

Why is it behaving like this?