Close and click handling