added error catching on open file