Do table locks get released after a query finishes when WAITFOR is used after that query within the same batch and transaction?
It depends on the transaction isolation level.

In read committed it will release locks.
In "Repeatable read" and "Serializable" it will hold locks.

You can find more info in the following article: SET TRANSACTION ISOLATION LEVEL