fixed bugs when close layer user got a white screen