Optimization of multistage membrane distillation system for treating shale gas produced water