Fixed visibility bug when switching from closed to open