Er, no. That won't work.
The bitwise AND you've got there will return 0 all the time, because this happens:
1101 (this is a metadata value expressed in binary.
0011 (3, binary)
0100 (4, binary)
metadata & 3 = (1101) & (0011) -> 1 & 0 = 0, 1 & 1 = 1 -> 0001
previous result & 4 = (0001) & (0100) -> 0000
In order to get the 4 directions preserving on/off and open/close you'd just return the metadata value without modifying it.