Close handles when application ends.
Call stub for exit.
Added 'getpid' API.