Git.pm: refactor command_close_bidi_pipe to use _cmd_close

The body of the loop in command_close_bidi_pipe function is identical to
what _cmd_close function does so instead of duplicating, change _cmd_close
so that it accepts list of file handles to be closed, which makes it
usable with command_close_bidi_pipe.
Git.pm: allow pipes to be closed prior to calling command_close_bidi_pipe

The command_close_bidi_pipe() function will insist on closing both
input and output pipes returned by command_bidi_pipe().  With this
change it is possible to close one of the pipes in advance and
pass undef as an argument.
Git.pm: add interface for git credential command

Add a credential() function which is an interface to the git
credential command.  The code is heavily based on credential_*
functions in <contrib/mw-to-git/git-remote-mediawiki>.
git-send-email: use git credential to obtain password

If smtp_user is provided but smtp_pass is not, instead of
prompting for password, make git-send-email use git
credential command instead.