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

Related to #1589.