Minior improvements to error checking. Add close command to server/client interaction.