Handle IO exceptions