James, Duke of York, Later King James II