Replace exit() with sys.exit() and unify the exit point

"exit is a helper for the interactive shell - sys.exit is intended for
use in programs." Refer to: http://stackoverflow.com/a/6501134