Removed 'die' on open failure and added file handle check