Bugfix: microscopic reversibility causing segfault

In certain circumstances, setting MICROSCOPIC_REVERSIBILITY to ON would
cause a segfault. This has been fixed, but a test should likely be added
to the testsuite so that it doesn't break in the future.
Fixed a number of small memory leaks.
A couple more memory leak fixes.