diff --git a/integration-tests/common.bash b/integration-tests/common.bash
index 8852c0ec2fae5b92b7d7693fbc77fa91fc444f5a..8e9a50d09811da4c6a7d1ef61303074cf54d0e56 100755
--- a/integration-tests/common.bash
+++ b/integration-tests/common.bash
@@ -436,6 +436,10 @@ function install_datamovers {
 
 function restart_openbis {
     assert_dir_exists_or_die $OPENBIS_SERVER
+    if [ "`check_server_port`" != "" ]; then
+    	# maybe server is just closing, wait a moment
+    	sleep 5
+    fi
     if [ "`check_server_port`" != "" ]; then
     	echo Shutting down openbis server.
 	    shutdown_openbis_server