Elasticsearch does not release lock on node.lock file

Sometimes when the machine shutsdown, the Elasticsearch is not releasing the lock on the node.lock file. Even after machine restart, ES is not able to lock the env stating failed to obtain node lock.

Similar issue occurs sometimes when the ES restarts due to OOM.

Any idea why is it happening?

ES version: 5.6.4
OS: windows