Britain will remain in the European Union until next year unless Parliament ratifies Boris Johnson's Brexit deal sooner, the remaining member states have agreed.