Add more hooks to ImageJ1's quitting routine

This branch adds a couple of extra hooks to ImageJ1 to facilitate better shutdown behavior.