add checkError for PrintWriter