checks for file existence before execution