Type \q and then press ENTER to quit psql.

Example:

postgres=# \q