pulled is_closed logic into a function so it can be used in one other place