This is an attempt to fix #507.  It does away with the realloc hack I was using before, and refactors so that when compressing an image, the compression module handles creation of the new Numpy array, and only once CFITSIO is complete and we know how large the compressed data buffer is going to be.  Then compress_hdu() returns the new Numpy array along with the heapsize.  This is a lot less spaghetti-ish than the previous code, and somewhat simpler overall.  Removed the test_insufficient_compression_allocation test since it no longer works correctly with the new code.  But that's okay--the test_lossless_gzip_compression test tests this case for us implicitly, which is why it was failing on Windows in the same way.  This is because the way CFITSIO estimates how much space it will need for the compressed data, it always ends up being less than what's needed for lossless compression.
Merge pull request #507 from iguananaut/issue-507

astropy.log: The process cannot access the file because it is being used by another process