Check for existence of file before opening it