added the isCloseable method in PrologEngine, and other minor changes