Updated file opening with error handling
Removed hard coded path in favour of command line args