mongo-sync: Only close the FD on reconnect if needed

When reconnecting and replacing the old FD with the new, only close the
old one if it is different from the new, otherwise we will end up
closing the new socket too. This fixes #25.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>