Added a validation function for the output directory