Reduce resource usage in MapReduce framework

I've noticed MapReduce jobs using more memory than necessary, so I tried to fix some of the problems I found.

A lot of the commits are about closing files after they've been used.

The "Use generators when partitioning local and remote files" commit saves the most memory, reducing the per-Mapper RES of my sample job from 1.2GB to around 300MB. The problem was each Boto Key uses quite a bit of memory, and we were storing a bunch of Keys in a list for all the remote files. This list persists when Mapper processes are forked, and we end up with a lot of used memory. The commit gets rid of the list by using a generator.
Won't the `with open(...)` result in closing the compressed (raw) file before the forked process has read from it?