Considering the unit work here
part filled in 2 hours=2*[(1/4) - (1/12) -(1/16)] = 5/24
==== remaining part = 1-5/24 = 19/24
net part filled in 1 hour will be(with tank B closed) =[(1/4) - (1/16)]=3/16
=== 3/16 part == 1hour
==== 19/24 part == (16/3)*(19/24) = 38/9 = 4.22 hrs