Bug in perl external omprog skeleton

Was in the middle of using this example to wrote a ActiveMQ output module and noticed the script never terminated.  After I got to looking at my code I noticed I had completely forgotten to watch for the EOF and handle it properly.  Once I had my code working I reviewed the example and noticed it had the same bug. 

Figured I would submit a pull to hopefully save someone else time in the future.  I wrote in in such a way that is will run onReceive() one last time so no messages are missing.

Thanks!