SERVER-12977 disallow empty write batches

Also fix shell batch processing to avoid extra empty batches.