You did turn off the interface elements, but too late for the viewport image to reflect that (as it was taken at the end of last frame). Like @bruce965 said, you should use await get_tree().idle_frame to wait until the image up to date, then get and save it.