How to close a chain when the pin was broken I was changing the chain on a bike with a Shimano gear shifter and when I was trying to push the pin in it broke off after only getting the front section in. 

How can I recover and attach the chain?
you could consider buying a quick link aka missing link from shimano, removing half a chain link (the one in which the broken off pin is located) and installing the quick link in its place. Alternatively if shortening the chain by just a bit is an option you could consider removing the chain link in which the broken off pin is located and reattaching the chain using a new pin from shimano (you can buy them separately from shimano; search for shimano chain pin).

alternatively you could try pushing the original pin which is currently inserted most of the way in using some water pump pliers and pushing the last section in using a chain tool.