refactor closeCanvas function