Properly dispose block and free GCHandles.