add exception handling when the file exists