Scanner: Fix deadlock on incorrectly identified files

This fixes a deadlock when scanning incorrectly identified files by introducing a configurable timeout.