RAII implementation of GIL