Fixed #1164: Add codes to errors generated by quit()

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