Moved file saving after matching process