public void close() throws IOException { if (line.isActive()) { line.flush(); line.stop(); } line.close(); }