properly close stdin
added example of searchTreaties overloading