Back in 2013, the system was changed so that when a question was closed, any custom moderator flags on it would not be automatically dismissed. However, this seems to only work when a question is closed by non-moderators. Custom moderator flags are still automatically marked helpful when the question is closed by a moderator. This question is reporting that what was implemented back in 2013 has either regressed in one case, or was left incomplete.
I just encountered an annoying situation where I had flagged a question with a custom reason, and a few minutes later my flag was marked as helpful, because a moderator closed the question when going through the close vote review queue without ever seeing my flag. (The timestamp of the flag dismissal exactly matches the closing time and I have asked them personally whether they saw my flag.) Moderators do not see flags in review queues for normal users, and when a post is closed the flags are automatically dismissed, so it is easy for custom flags to be accidentally dismissed without ever being seen.
The only flags which should be auto-dismissed when the question is closed are close and VLQ flags. Every other flag type should require an explicit moderator action to specifically mark the flag either "helpful" or "declined".
Please don't mark custom flags as helpful when a moderator closes the question.