A witness, served with a subpoena, must attend at the time appointed, with any papers under his control lawfully required by the subpoena, and answer all pertinent and legal questions; and, unless sooner discharged, must remain until the testimony is closed.