Задание

He (finish) working only by midnight.

finished

was finishing

had finished