Computing Dense and Sparse Subgraphs of Weakly Closed Graphs