Unable to execute workflow from jupyter notebook

I have configured KNIME AP in amazon linux environment and I have created a sample workflow and my goal is to execute workflows from python/jupyter notebook. Below is the workflow I created which is successfully executed from knime GUI.

image

But while executing the same from jupyter notebook I get error. Below is the code and error.

import knime
knime.executable_path = '/opt/knime/knime_4.3.0/knime'

workspace = '/home/user1/workflow1'
workflow = 'vertica_sample'
with knime.Workflow(workflow_path=workflow, workspace_path=workspace) as wf:
    wf.execute()
WARNING:root:Return code from KNIME execution was non-zero
WARNING:root:captured stdout: b'CompilerOracle: exclude javax/swing/text/GlyphView.getBreakSpot\nInstall location:\n    file:/opt/knime/knime_4.3.0/\nConfiguration file:\n    file:/opt/knime/knime_4.3.0/configuration/config.ini loaded\nConfiguration location:\n    file:/opt/knime/knime_4.3.0/configuration/\nFramework located:\n    file:/opt/knime/knime_4.3.0/plugins/org.eclipse.osgi_3.15.200.v20200214-1600.jar\nLoading extension: reference:file:org.eclipse.osgi.compatibility.state_1.1.700.v20200207-2156.jar\n\teclipse.properties not found\nLoading extension: reference:file:javax.transaction_1.1.1.v201105210645.jar\n\teclipse.properties not found\nFramework classpath:\n    file:/opt/knime/knime_4.3.0/plugins/org.eclipse.osgi_3.15.200.v20200214-1600.jar\n    file:/opt/knime/knime_4.3.0/plugins/\n    file:/opt/knime/knime_4.3.0/plugins/org.eclipse.osgi.compatibility.state_1.1.700.v20200207-2156.jar\n    file:/opt/knime/knime_4.3.0/plugins/javax.transaction_1.1.1.v201105210645.jar\nDebug options:\n    file:/home/user1/.options not found\nTime to load bundles: 4\nStarting application: 639\nStart VM: /opt/knime/knime_4.3.0//plugins/org.knime.binary.jre.linux.x86_64_1.8.0.252-b09/jre/bin/java\n-server\n-Dsun.java2d.d3d=false\n-Dosgi.classloader.lock=classname\n-XX:+UnlockDiagnosticVMOptions\n-XX:+UnsyncloadClass\n-XX:+UseG1GC\n-Dsun.net.client.defaultReadTimeout=0\n-XX:CompileCommand=exclude,javax/swing/text/GlyphView,getBreakSpot\n-Xmx2048m\n-Dorg.eclipse.swt.internal.gtk.disablePrinting\n-jar /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar\n-os linux\n-ws gtk\n-arch x86_64\n-launcher /opt/knime/knime_4.3.0/knime\n-name Knime\n--launcher.library /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.1100.v20190907-0426/eclipse_1801.so\n-startup /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar\n--launcher.overrideVmargs\n-exitdata 700014\n-debug\n-application org.knime.product.KNIME_BATCH_APPLICATION\n-data /tmp/tmp3y71183e/knime_data\n-nosave\n-workflowDir=/home/user1/workflow1/vertica_sample\n-vm /opt/knime/knime_4.3.0//plugins/org.knime.binary.jre.linux.x86_64_1.8.0.252-b09/jre/bin/java\n-vmargs\n-server\n-Dsun.java2d.d3d=false\n-Dosgi.classloader.lock=classname\n-XX:+UnlockDiagnosticVMOptions\n-XX:+UnsyncloadClass\n-XX:+UseG1GC\n-Dsun.net.client.defaultReadTimeout=0\n-XX:CompileCommand=exclude,javax/swing/text/GlyphView,getBreakSpot\n-Xmx2048m\n-Dorg.eclipse.swt.internal.gtk.disablePrinting\n-jar /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar \n'
WARNING:root:captured stderr: b'Mar 09, 2021 9:21:57 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener addExtensions\nINFO: Adding the extensions from bundle org.apache.cxf.cxf-rt-frontend-jaxrs (141) [org.apache.cxf.jaxrs.JAXRSBindingFactory]\nMar 09, 2021 9:21:57 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener addExtensions\nINFO: Adding the extensions from bundle org.apache.cxf.cxf-rt-transports-http (144) [org.apache.cxf.transport.http.HTTPTransportFactory, org.apache.cxf.transport.http.HTTPWSDLExtensionLoader, org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder, org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder, org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider]\nMar 09, 2021 9:21:57 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener addExtensions\nINFO: Adding the extensions from bundle org.apache.cxf.cxf-rt-transports-http-hc (145) [org.apache.cxf.transport.http.HTTPConduitFactory, org.apache.cxf.transport.ConduitInitiator]\nMar 09, 2021 9:21:57 AM org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer register\nINFO: Aries Blueprint packages not available. So namespaces will not be registered\nMar 09, 2021 9:21:57 AM org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer register\nINFO: Aries Blueprint packages not available. So namespaces will not be registered\nERROR\t main BatchExecutor\t Workflow is locked by another KNIME instance\nMar 09, 2021 9:21:57 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener unregister\nINFO: Removing the extensions for bundle 141\nMar 09, 2021 9:21:57 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener unregister\nINFO: Removing the extensions for bundle 144\nMar 09, 2021 9:21:57 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener unregister\nINFO: Removing the extensions for bundle 145\nKnime:\nNo exit data available.\nKnime:\nJVM terminated. Exit code=3\n/opt/knime/knime_4.3.0//plugins/org.knime.binary.jre.linux.x86_64_1.8.0.252-b09/jre/bin/java\n-server\n-Dsun.java2d.d3d=false\n-Dosgi.classloader.lock=classname\n-XX:+UnlockDiagnosticVMOptions\n-XX:+UnsyncloadClass\n-XX:+UseG1GC\n-Dsun.net.client.defaultReadTimeout=0\n-XX:CompileCommand=exclude,javax/swing/text/GlyphView,getBreakSpot\n-Xmx2048m\n-Dorg.eclipse.swt.internal.gtk.disablePrinting\n-jar /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar\n-os linux\n-ws gtk\n-arch x86_64\n-launcher /opt/knime/knime_4.3.0/knime\n-name Knime\n--launcher.library /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.1100.v20190907-0426/eclipse_1801.so\n-startup /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar\n--launcher.overrideVmargs\n-exitdata 700014\n-debug\n-application org.knime.product.KNIME_BATCH_APPLICATION\n-data /tmp/tmp3y71183e/knime_data\n-nosave\n-workflowDir=/home/user1/workflow1/vertica_sample\n-vm /opt/knime/knime_4.3.0//plugins/org.knime.binary.jre.linux.x86_64_1.8.0.252-b09/jre/bin/java\n-vmargs\n-server\n-Dsun.java2d.d3d=false\n-Dosgi.classloader.lock=classname\n-XX:+UnlockDiagnosticVMOptions\n-XX:+UnsyncloadClass\n-XX:+UseG1GC\n-Dsun.net.client.defaultReadTimeout=0\n-XX:CompileCommand=exclude,javax/swing/text/GlyphView,getBreakSpot\n-Xmx2048m\n-Dorg.eclipse.swt.internal.gtk.disablePrinting\n-jar /opt/knime/knime_4.3.0//plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar \n'

Can someone kindly help me to resolve this error.

A simple step to close the knime application before executing python script solved the error that I was getting but the workflow is not returning the final result of CSV Writer (though this worked in knime GUI). It is not writing the file to the location and I am not getting any error message or warning message.

Can someone please help.