Bug 1076032 - Attempting to unlock closed file descriptor

* Add guard to stop attempting to unlock a closed file descriptor