Use finish() instead of finalize().