added exception handling for printToFile

kwic2.java done