Trouble updating to 8.4.0

I have tried to update my Drupal site from 8.3.7 to 8.4.0, and it seems to proceed successfully if I delete composer.lock and the vendor directory and change the Drupal/core and symfony/css-selector versions to ~8.4 and ~3.3 respectively. However, when I go to /update.php, and proceed to the update, the process crashes after 5 updates (out of 13) with the message

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /update.php/start?id=6&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText:

and the site was completely broken.

I reverted to the backup 8.3.7 and tried /update.php in case there were earlier database updates outstanding, but I got a report “no pending updates”.

What can I do to fix this?

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/22/feed