$opts{file} was deleted too early