Is it safe to close laptop while "Shrinking APFS Data Structures"?

Interrupting the operation for any reason in the middle of it, like putting the laptop in sleep might (in case of sleep) or WILL (in case of everything else) corrupt the filesystem badly.

It may take more or less time as it moves around the data blocks from the place which is going to be removed from the partition. Depending on the arrangement of data on your disk as well as your general storage device performance it could take anywhere from 2 minutes (I had a new partition so I fell into this case) to several hours (if a lot of data needs to be relocated).