Check if file exists befor trying to open it