Closing properly all cursor, correcting some ui bugs when changing screen orientation