Stopped writing legend when closed