Yes, you need to add a Verification activity before the File Transfer activity.
Avoid unintended outcomes by verifying the data used in an Automation
Studio automation.
Use the Verification activity to avoid unintended automation outcomes.
The activity lets you select a target data extension in your
automation and evaluate the target data extension for conditions you
set.
So basically you check if there are any records in your DE, and if there aren't any, you stop the automation from running further steps:
Source: https://help.salesforce.com/articleView?id=mc_as_verification_activity.htm&type=5