Files are created because your if condition evaluates to True always.
if (cb.Checked || cb != null)
This condition is true even if the checkbox is not checked because you have applied || (or) and the checkbox is found ie its not null.
Simply change || to && that will make sure your code creates file only if "checkbox is found and is checked too"!