You did the absolute best thing you could have done, given the position you were in.
It's all about maximising marks.
It's easy to earn the first few marks whenever you're answering any sort of extended response question, but much, much harder to earn those couple extra marks that push you from something like an 8/10 to 10/10. In terms of maximising your overall score, you're almost always better off half-answering every single question rather than only fully answering half of them and leaving the other half completely blank.
If you had stubbornly insisted on finishing the first piece, only to get halfway through the second piece, that's like... 9 + 4 = 13 marks.
Instead, you moved on and got through the most important parts of both, which in terms of marks may work out more like 8 + 8 = 16 marks.
(I have no idea what your marks will be, I'm just trying to demonstrate that what you did was better for your overall exam performance).