单项选择题

He meant ______ his homework before lunch, but his pen didn't work.

A.finishing
B.having finished
C.finished
D.to finish