Code P0014 was a general - it a mask - ECM and PCM still trying to figure out the true condition - P0340 is another "Generic" but more specific.
P0340 is a Ford code for Camshaft Sensor - Sensor "A" - Circuit Malfunction.
So where was the VVT solenoid you messed with? There are two - both are on Cylinder 1 (By front of engine towards Coolant Reservoir) One for Intake the other for the Exhaust - while Cam position sensors are located to the back - both sets are on the valve cover - same aspects.
So, when you removed the VVT - intake side or exhaust side - you also affected the wiring or at least the aspect.
How did you clear the 1st code?
Make sure all connectors are seated on their respective sensors.
I'm going to provide a link...I'd like you to read this article...
https://www.troublecodes.net/fordcodes/p0340/
Pay particular attention to this statement...
Where am I going with this?
Fords have a Crankshaft position sensor too, and so does pretty much any vehicle with an engine in it these days.
Had a Scion at one time need service; had to clean a trap filter that ported oil to the front camshaft in a similar setup to Ford Fiesta engine design - but only one port, not two like the Fiesta. Once it was cleaned - the engine took several weeks of somewhat normal driving to get it to settle back down due to the changes in the pressures that advanced the timing from the oil filter trap getting cleaned.
Did not set any codes, just had to learn a new fuel / air / timing trim - that once it figured out it was at TDC when it should be then did the system take over and the engine ran normally.
So, across a different engine line and brand - this is a common problem, and you might want to revisit your work and see if you might have seated the valve but pinched an oil seal which blocks the plunger from moving the port to allow for the drain and fill and shift of timing that another sensor is looking for.
As always, pull the battery cable for a complete reset so the sensor alignment and connection can be "zeroed out" and a new idle trim profile can be stored - or at least allowed to run so it can figure out if any DTC's need to be set.