The sum of normal force from your hand and gravity are doing work on the pen in this example. There is net work done on the pen. 

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 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?][1]


  [1]: https://physics.stackexchange.com/questions/168972/is-it-possible-for-the-normal-force-to-do-work