Nick, shared resource lock state is determined in runtime and is not stored anywhere. So, if there is a hanging build that requires a write lock, this can cause described behaviour. In this case you should check for hanging builds and forcibly terminate them for lock to be released
Also, there is an issue TW-36042 in TeamCity 8.1.2 that causes resources with infinite quota to behave wrongly with write locks. If your behaviour matches that in the issue - the workaround (before 8.1.3 update) is to convert infinite resource to resource with specified quota