Switched from exit(0) to close().