stat file before attempting to open