Error handling for io.open