The US embassy in Sri Lanka has been closed and staff ordered to leave the compound following a security threat.