The sum of normal force from your hand and gravity are doing work on the pen in this example, when you displace it. If the normal is greater than gravity, then net work is done on the pen, as you rise it.
By the theorem stated, this gives the pen kinetic energy because while it is rising, it has some velocity. If the velocity was high enough, the pen would continue flying when you stop your hand (if you were to try this outside, hypothetically, put a pen on your open palm and raise your hand pretty fast).
In your example, when you stop moving your hand, any remaining velocity the pen has (which is tiny) will still propel it up and gravity will do work on the pen which means it will lose the kinetic energy and hence go to $0$.
In summary, at any point when the normal force is greater than gravity, there is a net force on the pen and thus displacing it will result work and so by the theorem a in a gain of kinetic energy.
Non-energy line of logic for comparison: at any point the normal force is greater than gravity, there is a net force on the pen and thus it accelerates by Newton's Second Law. This means it gains velocity.
Related question: Is it possible for the Normal Force to do work?