Cannot call disable_statement_timeout() without a transaction open or outside of a transaction block.
If you don't want to use a transaction wrap your code in a block call:

disable_statement_timeout { # code that requires disabled statement here }

This will make sure statement_timeout is disabled before and reset after the block execution is finished.
