It is the duty of a witness duly served with a subpoena to attend at the time appointed, with any papers, books, documents, or other things under his control required by the subpoena, to answer all pertinent and legal questions, and, unless sooner discharged, to remain until the testimony is closed.