If the mailbox is on hold, it will not be removed after removing the license. However, removing the license of a mailbox that is put on hold is a violation of the licensing terms.
Depending on your goal here, you might consider using Inactive mailboxes: https://learn.microsoft.com/en-us/purview/create-and-manage-inactive-mailboxes