Issue #1542: Use exit module instead of process.exit. Fixes #1541 and #1408.

Signed-off-by: Anton Kovalyov <anton@kovalyov.net>