It's most likely because the chunks are not unloaded immediately. Maybe the chunks will be unloaded in the next tick? If so you should delay getting the "after*" stuff until the next tick.
On a side note, you're dividing virtual RAM by 1204, I suppose that should be 1024?
On a side note, you're dividing virtual RAM by 1204, I suppose that should be 1024?