ContainerFix: Fixing Container Interface Issues in Minecraft
Unstable graphical interface behavior for containers is a widespread issue in modded game versions. The ContainerFix mod effectively resolves this shortcoming by automatically closing container interfaces when they are destroyed or removed from the world.
The problem was first discovered and documented by a developer named Darkosto. This comprehensive fix utility works in conjunction with other mods, ensuring proper display of windows for opening chests, furnaces, workbenches, and other blocks with graphical interfaces.

For Mod Developers
To prevent this issue in your own modifications, override the Container#canInteractWith method. Check whether the container object TileEntity exists in the game world and whether the player is close enough to the block to interact with it—this way you will ensure behavior compatible with the standard game code.
Example implementation:
@Override
public boolean canInteractWith(EntityPlayer player)
{
return te.world.getTileEntity(te.getPos()) == te && player.getDistanceSq(te.pos.add(0.5, 0.5, 0.5)) <= 64;
}