public synchronized void windowClosed(WindowEvent evt)
        {
                quit=true;
                this.notifyAll(); // stop all threads
                try { reader.join(1000);pin.close();   } catch (Exception e){}         
                try { reader2.join(1000);pin2.close(); } catch (Exception e){}
                System.exit(0);
        }