Added opening output file's folder and exeption handler