What do I have to do with my visa when I leave Japan for good?

When you leave Japan for good, you must surrender your Foreign Resident Registration card to Immigration officials at the airport. Immigration officials will invalidate your visa.

You would also be required to visit your local city office for notification of your departure from Japan.