Cleaning up null-pointer-deallocation warnings.

These warnings appear under multiple scenarios.  The easiest way to reproduce the problem is to open LMMS from the command line, then close it immediately without doing anything; upon checking the console one will see a slew of null-pointer deallocation warnings (as of 1d929d6ce7b5426b2ad3d0f56bf559d7e717f099).  The MemoryManager catches these, so ultimately they're benign, but the pointers should be checked before attempting to deallocate them.