We have had this issue in Server 2012 R2 and we could not find a fix anywhere so we simply did not use User Profile Disks. We have recently upgraded to Server 2016 with the same sort of setup and got the same issue. I spent a lot of time looking around the internet but no joy on any of the suggestions such as GPOs and disable caching on the UPD shared folder.

After having a long think about it, I have managed to come up with a workaround which is very simple until Microsoft decide to fix this issue. Simply set the Session Collection to 'Never' End a Disconnected Session.

For those who need to know how to do this.

1. Open Server Manager

2. Go to Remote Desktop Services

3. Click on the name of your session collection (Listed under the word Collections)

4. At the top, to the right of Properties, Click Tasks > Edit Properties

5. On the left, Click 'Session'

6. Change 'End a disconnected session' to Never

7. Click Apply

8. Click OK

For those who use GPOs, please update the GPO on your domain controller to never end a disconnected session.

I came to this by observing when this happens and wondered why this doesn't seem to happen to everyone that uses my terminal server. I noticed that the users that use the correct method of logging off by using the 'Sign Out' option do not get this issue but users that leave there session in a disconnected state by using the 'X' to close RDP on their own machine do get this problem.

There is a difference between Ending A Session and Logging Off A Session.

Logging off will go through the correct process to log the user out and release the User Profile Disk correctly

When the server is configured to End A Session, it simply cuts the connection, forces it to close and does not release the UDP.

Since I changed this setting, I have not had this problem again. When your servers reboot, it will log off all users connected to the server weather they are disconnected or not and a reboot will naturally release the disk because servers do not keep hold of mounted VHD or VHDX drives after reboots. Our server reboots every week to install Windows Updates so is not longer an issue for me.

Microsoft should really provide a fix for this but looks like it had been around for a few years now with no help from Microsoft. Hope my workaround helps others. Good Luck.