Yes, you are right. I think I put the checking code to the wrong place. 

The main cause of this bug is the lock if video file. So, we need to make dom.player to load empty file to release it. But in the place calling videodb.updateMetadata(video.name, video.metadata) (line 662), it throws an error all the way because of unavailable of sdcard.

And in the line 662, we don't catch this kind of exception that makes the completeHidingPlayer not be executed which is the real place to release file lock.

I can remove these checking code and use a simple try-catch on the line "videodb.updateMetadata(video.name, video.metadata)". How do yo think???