Protect the filesystem and microSD card by using a controlled shutdown, then wait for the operating system and storage activity to finish.