Catch any IOExceptions
Some small refactor to better understand what's happening here