This is a fix for a bug you can reproduce by following these steps:
1) Stand on 2 containers or more
2) Open one of them
3) Open the other one without closing the first or moving out
4) Move out
Notice the first container stays in an open state, and it's image shows it as open (and also breaks the image staying like that even if you actually get the container back to it's closed state). You can test whether it's open or not by trying to pickup something and see weird things happen, also by using 'a' to apply something that its not in the bag. I even remember dropping one item seeing it disapear, and then looking into the container to find it there.
To close the container after that you can just step in and out again. The container closes, but it's image stays open forever.
The check for applied flag was beeing made at the wrong object, not the one to close but the one you want to open.
Simple as that :-)
Committed to trunk as revision 18567, thanks for the fix :)