Add validation to file open