You can also run the command “poweroff” in SSH, to gracefully tell the system to close all processes and write any last data. Not really needed unless you have an external disk connected and want to make sure no data gets corrupt on it.