EU and US are close to pact on terror and privacy