Fix handling of closures when cloning objects (cc#2049)

Based on pull #128. Fixes [CC#2049](http://issue.cc/r3/2049). Tested in Linux (0.4.4).