how do you check if a file exists before you attempt to open it or write to it?