Added error catching to file chooser