Dismissing a web overlay

I’m trying to close a web overlay using by touching the close button. However although it appears to execute correctly e.g. the test passes, it doesn’t actually close the overlay.

Appium::TouchAction.new.press(:x => 291, :y => 41, :fingers => 1, :tapCount => 1, :duration => 1000).release

Grateful for any help