exception while opening a file, shorter code to check the day of the week