Function for relesing of canvas