Adds logic to close the grid when clicking on any tile.