Duality and dimensional reduction of 5D BF theory