Fix --pattern so it stil applies when `files_to_run` is accessed early.

Related to #1589.
Fix `files_to_run` so that setting `pattern` after it was already accessed.