needs-restarting: fix IOError when cannot read file.