Return code that makes more sense for an error. This also makes sure shutdown handlers are not called (which might try to operate on a incorrect state because of the error)